Skip to main content

Function

Enum Function 

Source
pub enum Function {
Show 61 variants FindAll { collection: String, }, Query { collection: String, filter: Option<Value>, sort: Option<Vec<SortFieldConfig>>, limit: Option<Value>, skip: Option<Value>, }, Project { fields: Vec<String>, exclude: bool, }, Group { by_fields: Vec<String>, functions: Vec<GroupFunctionConfig>, }, Count { output_field: String, }, FindById { collection: String, record_id: String, }, FindOne { collection: String, key: String, value: Value, }, Insert { collection: String, record: Value, bypass_ripple: Option<bool>, ttl: Option<Value>, }, Update { collection: String, filter: Value, updates: Value, bypass_ripple: Option<bool>, ttl: Option<Value>, }, UpdateById { collection: String, record_id: String, updates: Value, bypass_ripple: Option<bool>, ttl: Option<Value>, }, FindOneAndUpdate { collection: String, filter: Value, updates: Value, bypass_ripple: Option<bool>, ttl: Option<Value>, }, UpdateWithAction { collection: String, filter: Value, actions: Value, bypass_ripple: Option<bool>, }, Delete { collection: String, filter: Value, bypass_ripple: Option<bool>, }, DeleteById { collection: String, record_id: String, bypass_ripple: Option<bool>, }, BatchInsert { collection: String, records: Value, bypass_ripple: Option<bool>, }, BatchDelete { ids: Value, bypass_ripple: bool, }, HttpRequest { url: String, method: String, headers: Option<HashMap<String, String>>, body: Option<Value>, timeout_seconds: Option<u64>, output_field: Option<String>, }, VectorSearch { query_vector: Vec<f32>, options: Option<Value>, }, TextSearch { collection: String, query_text: Value, fields: Option<Vec<String>>, limit: Option<Value>, fuzzy: Option<bool>, }, HybridSearch { text_query: String, vector_query: Vec<f32>, options: Option<Value>, }, Chat { messages: Vec<ChatMessage>, model: Option<String>, temperature: Option<f32>, max_tokens: Option<i32>, }, Embed { input_field: String, output_field: String, model: Option<String>, }, If { condition: FunctionCondition, then_functions: Vec<Box<Function>>, else_functions: Option<Vec<Box<Function>>>, }, ForEach { functions: Vec<Box<Function>>, }, CallFunction { function_label: String, params: Option<HashMap<String, Value>>, }, CreateSavepoint { name: String, }, RollbackToSavepoint { name: String, }, ReleaseSavepoint { name: String, }, KvGet { key: Value, }, KvSet { key: Value, value: Value, ttl: Option<Value>, }, KvDelete { key: Value, }, KvExists { key: Value, output_field: Option<String>, }, KvQuery { pattern: Option<Value>, include_expired: bool, }, SWR { cache_key: String, ttl: Value, url: String, method: String, headers: Option<HashMap<String, String>>, body: Option<Value>, timeout_seconds: Option<u64>, output_field: Option<String>, collection: Option<String>, }, BcryptHash { plain: String, cost: Option<u32>, output_field: String, }, BcryptVerify { plain: String, hash_field: String, output_field: String, }, RandomToken { bytes: usize, encoding: Option<String>, output_field: String, }, JwtSign { claims: HashMap<String, Value>, secret: String, algorithm: Option<String>, expires_in_secs: Option<i64>, output_field: String, }, JwtVerify { token_field: String, secret: String, algorithm: Option<String>, output_field: String, }, EmailSend { to: String, subject: String, body: String, from: String, reply_to: Option<String>, api_key: String, provider: Option<String>, html: Option<bool>, output_field: Option<String>, }, HmacSign { input: String, secret: String, algorithm: Option<String>, output_field: String, encoding: Option<String>, }, HmacVerify { input: String, provided_mac: String, secret: String, algorithm: Option<String>, encoding: Option<String>, output_field: String, }, AesEncrypt { plaintext: String, key: String, key_encoding: Option<String>, output_field: String, }, AesDecrypt { ciphertext_field: String, key: String, key_encoding: Option<String>, output_field: String, }, UuidGenerate { output_field: String, }, TotpGenerate { secret: String, digits: Option<u32>, period: Option<u64>, algorithm: Option<String>, output_field: String, }, TotpVerify { code: String, secret: String, digits: Option<u32>, period: Option<u64>, algorithm: Option<String>, skew: Option<u8>, output_field: String, }, Base64Encode { input: String, url_safe: Option<bool>, output_field: String, }, Base64Decode { input: String, url_safe: Option<bool>, output_field: String, }, HexEncode { input: String, output_field: String, }, HexDecode { input: String, output_field: String, }, Slugify { input: String, output_field: String, }, IdempotencyClaim { key: String, ttl_secs: u64, output_field: String, }, RateLimit { key: String, limit: u64, window_secs: u64, on_exceed: Option<String>, output_field: String, }, LockAcquire { key: String, ttl_secs: u64, output_field: String, }, LockRelease { key: String, token: String, output_field: String, }, TryCatch { try_functions: Vec<Box<Function>>, catch_functions: Vec<Box<Function>>, output_error_field: Option<String>, }, Parallel { functions: Vec<Box<Function>>, wait_for_all: bool, }, Sleep { duration_ms: Value, }, Return { fields: HashMap<String, Value>, status_code: Option<u16>, }, Validate { schema: Value, data_field: String, on_error: Option<Vec<Box<Function>>>, },
}
Expand description

Function step in a pipeline

Variants§

§

FindAll

Find all records in collection

Fields

§collection: String
§

Query

Query records with advanced options

Fields

§collection: String
§filter: Option<Value>
§limit: Option<Value>
§

Project

Project specific fields

Fields

§fields: Vec<String>
§exclude: bool
§

Group

Group records with functions

Fields

§by_fields: Vec<String>
§

Count

Count records

Fields

§output_field: String
§

FindById

Find record by ID

Fields

§collection: String
§record_id: String
§

FindOne

Find one record by key/value

Fields

§collection: String
§value: Value
§

Insert

Insert a record

Fields

§collection: String
§record: Value
§bypass_ripple: Option<bool>
§

Update

Update records matching filter

Fields

§collection: String
§filter: Value
§updates: Value
§bypass_ripple: Option<bool>
§

UpdateById

Update record by ID

Fields

§collection: String
§record_id: String
§updates: Value
§bypass_ripple: Option<bool>
§

FindOneAndUpdate

Find one record and update atomically

Fields

§collection: String
§filter: Value
§updates: Value
§bypass_ripple: Option<bool>
§

UpdateWithAction

Update with actions (increment/decrement)

Fields

§collection: String
§filter: Value
§actions: Value
§bypass_ripple: Option<bool>
§

Delete

Delete records matching filter

Fields

§collection: String
§filter: Value
§bypass_ripple: Option<bool>
§

DeleteById

Delete record by ID

Fields

§collection: String
§record_id: String
§bypass_ripple: Option<bool>
§

BatchInsert

Batch insert records

Fields

§collection: String
§records: Value
§bypass_ripple: Option<bool>
§

BatchDelete

Batch delete records

Fields

§ids: Value
§bypass_ripple: bool
§

HttpRequest

HTTP request

Fields

§method: String
§timeout_seconds: Option<u64>
§output_field: Option<String>
§

VectorSearch

Vector search

Fields

§query_vector: Vec<f32>
§options: Option<Value>
§

TextSearch

Text search

Fields

§collection: String
§query_text: Value
§fields: Option<Vec<String>>
§limit: Option<Value>
§fuzzy: Option<bool>
§

HybridSearch

Hybrid search (text + vector)

Fields

§text_query: String
§vector_query: Vec<f32>
§options: Option<Value>
§

Chat

AI Chat completion

Fields

§messages: Vec<ChatMessage>
§temperature: Option<f32>
§max_tokens: Option<i32>
§

Embed

Generate embeddings for field in records

Fields

§input_field: String
§output_field: String
§

If

Conditional execution

Fields

§then_functions: Vec<Box<Function>>
§else_functions: Option<Vec<Box<Function>>>
§

ForEach

For each record, execute Functions

Fields

§functions: Vec<Box<Function>>
§

CallFunction

Call a saved UserFunction by label

Fields

§function_label: String
§

CreateSavepoint

Create a savepoint for partial rollback

Fields

§name: String
§

RollbackToSavepoint

Rollback to a specific savepoint

Fields

§name: String
§

ReleaseSavepoint

Release a savepoint (no longer needed)

Fields

§name: String
§

KvGet

Get a value from the KV store Returns {value: } on hit, {value: null} on miss

Fields

§key: Value
§

KvSet

Set a value in the KV store

Fields

§key: Value
§value: Value
§

KvDelete

Delete a key from the KV store

Fields

§key: Value
§

KvExists

Check if a key exists in the KV store

Fields

§key: Value
§output_field: Option<String>
§

KvQuery

Query the KV store with a pattern

Fields

§pattern: Option<Value>
§include_expired: bool
§

SWR

SWR (Stale-While-Revalidate) pattern for external API caching Automatically handles: KV cache check → HTTP request → KV cache set → optional audit storage

Fields

§cache_key: String
§ttl: Value
§method: String
§timeout_seconds: Option<u64>
§output_field: Option<String>
§collection: Option<String>
§

BcryptHash

Bcrypt-hash a plaintext value and write the result onto every record in the working data (creates a single result record if the working set is empty). Use in a compound users_register function. Requires ekoDB >= 0.41.0.

Fields

§plain: String

Plaintext to hash, typically "{{password}}".

§cost: Option<u32>

bcrypt cost factor (4..=31). Defaults to 12 when None.

§output_field: String

Field name to write the bcrypt hash string into.

§

BcryptVerify

Verify a plaintext against a bcrypt hash stored on the first record in the working data; writes a boolean result into output_field. Pair with an If stage for login flows. Requires ekoDB >= 0.41.0.

Fields

§plain: String

Plaintext to verify, typically "{{password}}".

§hash_field: String

Name of the field on the current record holding the stored bcrypt hash (e.g. "password_hash").

§output_field: String

Field name to write the boolean result into.

§

RandomToken

Generate a cryptographically-random token and add it to every record in the working data. Requires ekoDB >= 0.41.0.

Fields

§bytes: usize

Number of random bytes (1..=1024).

§encoding: Option<String>

“hex” | “base64” | “base64url” (default “hex”).

§output_field: String

Field name to write the encoded token into.

§

JwtSign

Sign a JWT and write the resulting token to every working record. claims is the payload; iat and exp are auto-stamped when expires_in_secs is set. Pair with BcryptVerify to issue a session token after login. Use "{{env.JWT_SECRET}}" for secret so the LLM never sees the operator-owned signing key. Requires ekoDB >= 0.42.0.

Fields

§claims: HashMap<String, Value>

JWT payload claims (raw JSON values).

§secret: String

Signing secret. Typically "{{env.JWT_SECRET}}".

§algorithm: Option<String>

“HS256” | “HS384” | “HS512” (default “HS256”).

§expires_in_secs: Option<i64>

Lifetime in seconds. Auto-stamps iat + exp when set.

§output_field: String

Field name to write the signed JWT into.

§

JwtVerify

Verify a JWT held in token_field on the first working record. On success, writes the decoded claims object into output_field. On failure (invalid signature, malformed, expired, missing token), writes null. Branch with If { FieldEquals { field: output_field, value: null } } to reject. Requires ekoDB >= 0.42.0.

Fields

§token_field: String

Field on the working record holding the JWT string.

§secret: String

Verification secret. Must match the signing secret.

§algorithm: Option<String>

Expected algorithm (default “HS256”).

§output_field: String

Field name to write the decoded claims object into.

§

EmailSend

Send a transactional email through a provider’s REST API. Today only provider = "sendgrid" is supported. Pull the API key from {{env.SENDGRID_API_KEY}} so the LLM never sees the operator-owned secret. Result envelope {provider_status, provider_message, provider} is written to output_field (defaults to "email_send"). Requires ekoDB >= 0.42.0.

Fields

§to: String

Recipient email.

§subject: String

Subject line.

§body: String

Plain-text or HTML body (set html: Some(true) for HTML).

§from: String

Sender email (must be verified with the provider).

§reply_to: Option<String>

Optional reply-to header.

§api_key: String

Provider API key (typically "{{env.SENDGRID_API_KEY}}").

§provider: Option<String>

Provider name. None defaults to "sendgrid".

§html: Option<bool>

When true, body is sent as text/html. Default: false.

§output_field: Option<String>

Field name for the result envelope. Defaults to "email_send".

§

HmacSign

HMAC-SHA256/384/512 message authentication. Pair with HmacVerify for inbound webhook signing or pre-signed URL generation. Requires ekoDB >= 0.42.0.

Fields

§input: String
§secret: String
§algorithm: Option<String>
§output_field: String
§encoding: Option<String>
§

HmacVerify

HMAC verification (constant-time). Writes a boolean.

Fields

§input: String
§provided_mac: String
§secret: String
§algorithm: Option<String>
§encoding: Option<String>
§output_field: String
§

AesEncrypt

AES-256-GCM authenticated encryption. Writes {ciphertext, nonce} (both base64) to output_field.

Fields

§plaintext: String
§key_encoding: Option<String>
§output_field: String
§

AesDecrypt

AES-256-GCM authenticated decryption. Reads the envelope from ciphertext_field, writes the recovered plaintext or null (fail-closed).

Fields

§ciphertext_field: String
§key_encoding: Option<String>
§output_field: String
§

UuidGenerate

Generate a v4 UUID into output_field.

Fields

§output_field: String
§

TotpGenerate

Generate a TOTP code (RFC 6238) from a base32 secret.

Fields

§secret: String
§digits: Option<u32>
§period: Option<u64>
§algorithm: Option<String>
§output_field: String
§

TotpVerify

Verify a user-submitted TOTP code; tolerates skew time-steps either side (default 1).

Fields

§code: String
§secret: String
§digits: Option<u32>
§period: Option<u64>
§algorithm: Option<String>
§skew: Option<u8>
§output_field: String
§

Base64Encode

Base64 encode (url_safe = Some(true) for URL-safe / no-pad).

Fields

§input: String
§url_safe: Option<bool>
§output_field: String
§

Base64Decode

Base64 decode → UTF-8 string. Fail-closed.

Fields

§input: String
§url_safe: Option<bool>
§output_field: String
§

HexEncode

Hex encode (lowercase).

Fields

§input: String
§output_field: String
§

HexDecode

Hex decode → UTF-8 string. Fail-closed.

Fields

§input: String
§output_field: String
§

Slugify

URL-friendly slug.

Fields

§input: String
§output_field: String
§

IdempotencyClaim

Idempotency-key claim. Atomically claims the key (KV SETNX with TTL); on first call writes {claimed: true, key}, on replay writes {claimed: false, key, response}. Requires ekoDB >= 0.42.0.

Fields

§ttl_secs: u64
§output_field: String
§

RateLimit

Fixed-window rate-limit gate. Increments a counter under rate:<key>:<window-floor>; over-limit either errors (on_exceed = "fail", default) or writes allowed: false (on_exceed = "skip").

Fields

§limit: u64
§window_secs: u64
§on_exceed: Option<String>
§output_field: String
§

LockAcquire

Distributed-lock acquire (token-fenced). On success writes {acquired: true, token}; pass that token to LockRelease.

Fields

§ttl_secs: u64
§output_field: String
§

LockRelease

Distributed-lock release; only deletes the key when the stored token matches token (prevents foreign release).

Fields

§token: String
§output_field: String
§

TryCatch

Try/Catch error handling for graceful failure recovery. Executes try_functions, and if any fail, executes catch_functions.

Fields

§try_functions: Vec<Box<Function>>
§catch_functions: Vec<Box<Function>>
§output_error_field: Option<String>
§

Parallel

Execute multiple functions in parallel (concurrently). All functions run simultaneously, results are merged.

Fields

§functions: Vec<Box<Function>>
§wait_for_all: bool
§

Sleep

Sleep/delay execution for rate limiting or timing control.

Fields

§duration_ms: Value
§

Return

Return a shaped response (final output formatting). Constructs the final response object from current execution context.

Fields

§status_code: Option<u16>
§

Validate

Validate data against a JSON schema before processing.

Fields

§schema: Value
§data_field: String
§on_error: Option<Vec<Box<Function>>>

Trait Implementations§

Source§

impl Clone for Function

Source§

fn clone(&self) -> Function

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Function

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Function

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Function

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more