Enum pliantdb_core::kv::Command[][src]

pub enum Command {
    Set {
        value: Value,
        expiration: Option<Timestamp>,
        keep_existing_expiration: bool,
        check: Option<KeyCheck>,
        return_previous_value: bool,
    },
    Get {
        delete: bool,
    },
    Increment {
        amount: Numeric,
        saturating: bool,
    },
    Decrement {
        amount: Numeric,
        saturating: bool,
    },
    Delete,
}
Expand description

Commands for a key-value store.

Variants

Set

Set a key/value pair.

Show fields

Fields of Set

value: Value

The value.

expiration: Option<Timestamp>

If set, the key will be set to expire automatically.

keep_existing_expiration: bool

If true and the key already exists, the expiration will not be updated. If false and an expiration is provided, the expiration will be set.

check: Option<KeyCheck>

Conditional checks for whether the key is already present or not.

return_previous_value: bool

If true and the key already exists, the existing key will be returned if overwritten.

Get

Get the value from a key.

Show fields

Fields of Get

delete: bool

Remove the key after retrieving the value.

Increment

Increment a numeric key. Returns an error if the key cannot be deserialized to the same numeric type as amount. If saturating is true, overflows will be prevented and the value will remain within the numeric bounds.

Show fields

Fields of Increment

amount: Numeric

The amount to increment by.

saturating: bool

If true, the result will be constrained to the numerical bounds of the type of amount.

Decrement

Decrement a numeric key. Returns an error if the key cannot be deserialized to the same numeric type as amount. If saturating is true, overflows will be prevented and the value will remain within the numeric bounds.

Show fields

Fields of Decrement

amount: Numeric

The amount to increment by.

saturating: bool

If true, the result will be constrained to the numerical bounds of the type of amount.

Delete

Delete a key.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.