common_macro

Attribute Macro admin_fn

source
#[admin_fn]
Expand description

Attribute macro to convert a normal function to SQL administration function. The annotated function should accept:

  • &ProcedureServiceHandlerRef or &TableMutationHandlerRef or FlowServiceHandlerRef as the first argument,
  • &QueryContextRef as the second argument, and
  • &[ValueRef<'_>] as the third argument which is SQL function input values in each row.

Return type must be common_query::error::Result<Value>.

§Example see common/function/src/system/procedure_state.rs.

§Arguments

  • name: The name of the generated Function implementation.
  • ret: The return type of the generated SQL function, it will be transformed into ConcreteDataType::{ret}_datatype() result.
  • display_name: The display name of the generated SQL function.
  • sig_fn: the function to returns Signature of generated Function.

Note that this macro should only be used in common-function crate for now