#[derive(RedisTransportValue)]
{
// Attributes available to this derive:
#[redis]
}
Expand description
Derive procedural macro that automatically generate implementation for
RedisTransportValue
, which requires implementation of the following:
§Example
#[derive(redis_om::RedisTransportValue)]
struct Test {
#[redis(primary_key)] // required if no `id` field exists
field_one: String,
field_two: i32,
field_three: Vec<u8>,
}
§Attributes
§rename_all = "some_case"
This attribute sets the default casing to be used for field names when generating Redis command arguments. Possible values are:
"snake_case"
: field names will be converted tosnake_case
"kebab-case"
: field names will be converted tokebab-case
"camelCase"
: field names will be converted tocamelCase
"PascalCase"
: field names will be converted toPascalCase
This attribute can be overridden for individual fields using the rename
attribute.
§rename = "some_field"
This attribute sets the Redis key name to be used for a field when generating Redis command arguments.
This attribute takes precedence over the rename_all
attribute.
§Restrictions
- Enums with fields are not supported
- Generics are not supported
- Public fields are required
- Fields with types that do not implement
ToRedisArgs
andFromRedisValue
are not supported