Skip to main content

Module sqlfunc

Module sqlfunc 

Source

StructsΒ§

Modifiers πŸ”’
Modifiers passed as key-value pairs to the #[sqlfunc] macro.

EnumsΒ§

Arity πŸ”’
Arity classification for a function annotated with #[sqlfunc].
GenericUsage πŸ”’
How a generic type parameter T appears in a type.
SqlName πŸ”’
A name for the SQL function. It can be either a literal or a macro, thus we can’t use String or syn::Expr directly.

FunctionsΒ§

arg_type πŸ”’
Determines the argument type of the nth argument of the function.
binary_func πŸ”’
Produce a EagerBinaryFunc implementation.
camel_case πŸ”’
classify_generic_usage πŸ”’
Classifies how a generic type parameter appears in a type.
container_idents_match πŸ”’
Compare two container type paths by their ident segments (ignoring lifetimes and generic arguments). Two containers are β€œsame” if their path idents match.
derive_output_type_for_generic πŸ”’
Derives an output_type_expr for a single generic parameter.
derive_output_type_for_generics πŸ”’
Derives an output_type_expr TokenStream from the structural relationship between input types and the output type, based on where generic parameters appear.
determine_arity πŸ”’
Determines the arity of a function annotated with #[sqlfunc].
element_type_expr πŸ”’
Generates a token stream that extracts the T-level SQL type from an input access expression, based on how T is used in that input.
elide_lifetimes πŸ”’
Replaces all lifetime parameters in a syn::TypePath with '_.
elide_lifetimes_in_type πŸ”’
Recursively replaces all lifetime parameters in a syn::Type with '_.
erase_all_generic_params πŸ”’
Erases all generic type parameters from a type, replacing each with Datum<'a>.
erase_generic_param πŸ”’
Replaces occurrences of a generic type parameter with Datum<'a> in a type.
find_generic_type_params πŸ”’
Extracts generic type parameters from a function signature. Returns an empty Vec if there are no type parameters.
fnv1a64 πŸ”’
FNV-1a, 64 bit. A fingerprint, not a secure hash: it only needs to be stable across builds and sensitive to any change in its input.
generate_test πŸ”’
is_nullable_type πŸ”’
Convert an identifier to a camel-cased identifier. Checks if a parameter type accepts NULL.
is_option_wrapped πŸ”’
Returns whether the outermost wrapper of a type is Option.
is_variadic_arg πŸ”’
Checks whether a parameter’s type is Variadic<...> or OptionalArg<...>, which indicates the function should be treated as variadic regardless of parameter count.
is_variadic_type πŸ”’
Checks if a type is Variadic<T>.
last_is_arena πŸ”’
Checks if the last parameter of the function is a &RowArena.
non_nullable_position_checks πŸ”’
Generates per-position nullability checks for non-nullable parameters.
output_type πŸ”’
Determine the output type for a function. Returns an error if the function does not return a value.
patch_lifetimes πŸ”’
Recursively patches lifetimes in a type, adding 'a to references without a lifetime and recursing into generic arguments and tuples.
probe_column_type πŸ”’
An expression of type Option<SqlColumnType>: the column type of ty if it implements AsColumnType, else None. Resolved by autoref specialization on ColumnTypeProbe, so it needs no trait bound the macro cannot check.
probe_column_types πŸ”’
One probe expression per datum a parameter consumes. Variadic<T> stands for two T arguments and OptionalArg<T> for one present T.
render_into πŸ”’
render_tokens πŸ”’
Renders a token stream as compact, canonical source text.
single_generic_arg πŸ”’
The last path segment’s name and its single type argument, for types shaped like Wrapper<T>.
sqlfunc
Implementation for the #[sqlfunc] macro. The first parameter is the attribute arguments, the second is the function body. The third parameter indicates whether to include the test function in the output.
sqlfunc_source πŸ”’
Emits the source-derived members of the generated FuncName impl: the SQLFUNC const (declaration text, types-only signature, body fingerprint) and sqlfunc_input_types, which yields the column types the function naturally consumes when every parameter type has one. Both exist only under mz-expr’s func-registry feature, like the trait members they implement.
staticize_lifetimes πŸ”’
Replaces every lifetime in ty with 'static, so a type written against the trait impl’s 'a can be named in a function body.
type_contains_ident πŸ”’
Returns whether a type syntactically contains an identifier.
unary_func πŸ”’
Produce a EagerUnaryFunc implementation.
variadic_element_is_nullable πŸ”’
For a Variadic<T> type, checks if T accepts NULL.
variadic_func πŸ”’
Produce an EagerVariadicFunc implementation.