pub trait CmdExt {
Show 22 methods
// Required methods
fn eappend<'a, S: ToRedisArgs, E: ToRedisArgs>(
stream_id: S,
event_name: E,
options: EAppendOptions<'a>,
) -> Self;
fn emappend<'a>(
partition_key: Uuid,
events: &'a [EMAppendEvent<'a>],
) -> Self;
fn eget<'a>(event_id: Uuid) -> Self;
fn epscan_by_key<'a>(
partition_key: Uuid,
start_sequence: u64,
end_sequence: Option<u64>,
count: Option<u64>,
) -> Self;
fn epscan_by_id<'a>(
partition_id: u16,
start_sequence: u64,
end_sequence: Option<u64>,
count: Option<u64>,
) -> Self;
fn escan<'a>(
stream_id: &'a str,
start_version: u64,
end_version: Option<u64>,
count: Option<u64>,
) -> Self;
fn escan_with_partition_key<'a>(
stream_id: &'a str,
partition_key: Uuid,
start_version: u64,
end_version: Option<u64>,
count: Option<u64>,
) -> Self;
fn epseq_by_key<'a>(partition_key: Uuid) -> Self;
fn epseq_by_id<'a>(partition_id: u16) -> Self;
fn esver<'a>(stream_id: &'a str) -> Self;
fn esver_with_partition_key<'a>(
stream_id: &'a str,
partition_key: Uuid,
) -> Self;
fn esub<'a, S: ToRedisArgs>(stream_id: S) -> Self;
fn esub_with_partition_key<'a, S: ToRedisArgs>(
stream_id: S,
partition_key: Uuid,
) -> Self;
fn esub_from_version<'a, S: ToRedisArgs>(
stream_id: S,
from_version: u64,
) -> Self;
fn esub_with_partition_and_version<'a, S: ToRedisArgs>(
stream_id: S,
partition_key: Uuid,
from_version: u64,
) -> Self;
fn epsub_by_key<'a>(partition_key: Uuid) -> Self;
fn epsub_by_id<'a>(partition_id: u16) -> Self;
fn epsub_by_key_from_sequence<'a>(
partition_key: Uuid,
from_sequence: u64,
) -> Self;
fn epsub_by_id_from_sequence<'a>(
partition_id: u16,
from_sequence: u64,
) -> Self;
fn hello<'a>(version: u32) -> Self;
fn ping<'a>() -> Self;
fn eack<'a>(subscription_id: Uuid, cursor: u64) -> Self;
}Required Methods§
Sourcefn eappend<'a, S: ToRedisArgs, E: ToRedisArgs>(
stream_id: S,
event_name: E,
options: EAppendOptions<'a>,
) -> Self
fn eappend<'a, S: ToRedisArgs, E: ToRedisArgs>( stream_id: S, event_name: E, options: EAppendOptions<'a>, ) -> Self
Append an event to a stream.
§Parameters
stream_id: Stream identifier to append the event toevent_name: Name/type of the eventoptions: Configuration for optional parameters (event_id, partition_key, expected_version, payload, metadata)
§Example
let options = EAppendOptions::new()
.payload(br#"{"name":"john"}"#)
.metadata(br#"{"source":"api"}"#);
conn.eappend("my-stream", "UserCreated", options)?;§Returns
Returns an AppendInfo containing event metadata.
Sourcefn emappend<'a>(partition_key: Uuid, events: &'a [EMAppendEvent<'a>]) -> Self
fn emappend<'a>(partition_key: Uuid, events: &'a [EMAppendEvent<'a>]) -> Self
Append multiple events to streams in a single transaction.
§Parameters
partition_key: UUID that determines which partition all events will be written toevents: Array of events to append, each with their own configuration
§Example
let events = [
EMAppendEvent::new("stream1", "EventA").payload(br#"{"data":"value1"}"#),
EMAppendEvent::new("stream2", "EventB").payload(br#"{"data":"value2"}"#),
];
conn.emappend(partition_key, &events)?;Note: All events are appended atomically in a single transaction.
§Returns
Returns transaction result information.
Sourcefn epscan_by_key<'a>(
partition_key: Uuid,
start_sequence: u64,
end_sequence: Option<u64>,
count: Option<u64>,
) -> Self
fn epscan_by_key<'a>( partition_key: Uuid, start_sequence: u64, end_sequence: Option<u64>, count: Option<u64>, ) -> Self
Scan events in a partition by partition key.
§Parameters
partition_key: UUID key to determine which partition to scanstart_sequence: Starting sequence numberend_sequence: Ending sequence number (Nonemeans scan to end)count: Maximum number of events to return (defaults to 100)
§Example
let partition_key = Uuid::parse_str("550e8400-e29b-41d4-a716-446655440000")?;
let batch = conn.epscan_by_key(partition_key, 0, Some(100), Some(50))?;§Returns
Returns an EventBatch containing events and pagination info.
Sourcefn epscan_by_id<'a>(
partition_id: u16,
start_sequence: u64,
end_sequence: Option<u64>,
count: Option<u64>,
) -> Self
fn epscan_by_id<'a>( partition_id: u16, start_sequence: u64, end_sequence: Option<u64>, count: Option<u64>, ) -> Self
Scan events in a partition by partition ID.
§Parameters
partition_id: Numeric partition identifier (0-65535)start_sequence: Starting sequence numberend_sequence: Ending sequence number (Nonemeans scan to end)count: Maximum number of events to return (defaults to 100)
§Example
let batch = conn.epscan_by_id(42, 100, Some(200), Some(50))?;§Returns
Returns an EventBatch containing events and pagination info.
Sourcefn escan<'a>(
stream_id: &'a str,
start_version: u64,
end_version: Option<u64>,
count: Option<u64>,
) -> Self
fn escan<'a>( stream_id: &'a str, start_version: u64, end_version: Option<u64>, count: Option<u64>, ) -> Self
Scan events in a stream by stream ID.
§Parameters
stream_id: Stream identifier to scanstart_version: Starting version numberend_version: Ending version number (Nonemeans scan to end)count: Maximum number of events to return (defaults to 100)
§Example
let events = conn.escan("my-stream", 0, Some(100), Some(50))?;§Returns
Returns events from the stream across all partitions.
Sourcefn escan_with_partition_key<'a>(
stream_id: &'a str,
partition_key: Uuid,
start_version: u64,
end_version: Option<u64>,
count: Option<u64>,
) -> Self
fn escan_with_partition_key<'a>( stream_id: &'a str, partition_key: Uuid, start_version: u64, end_version: Option<u64>, count: Option<u64>, ) -> Self
Scan events in a stream by stream ID within a specific partition.
§Parameters
stream_id: Stream identifier to scanpartition_key: UUID to scan within a specific partition onlystart_version: Starting version numberend_version: Ending version number (Nonemeans scan to end)count: Maximum number of events to return (defaults to 100)
§Example
let partition_key = Uuid::parse_str("550e8400-e29b-41d4-a716-446655440000")?;
let batch = conn.escan_with_partition_key("my-stream", partition_key, 0, Some(100), Some(50))?;§Returns
Returns an EventBatch containing events from the specified partition only.
Sourcefn epseq_by_key<'a>(partition_key: Uuid) -> Self
fn epseq_by_key<'a>(partition_key: Uuid) -> Self
Get the current sequence number for a partition by partition key.
§Parameters
partition_key: UUID key to determine which partition to query
§Example
let partition_key = Uuid::parse_str("550e8400-e29b-41d4-a716-446655440000")?;
let sequence = conn.epseq_by_key(partition_key)?;§Returns
Returns the current sequence number for the partition.
Sourcefn epseq_by_id<'a>(partition_id: u16) -> Self
fn epseq_by_id<'a>(partition_id: u16) -> Self
Sourcefn esver_with_partition_key<'a>(stream_id: &'a str, partition_key: Uuid) -> Self
fn esver_with_partition_key<'a>(stream_id: &'a str, partition_key: Uuid) -> Self
Get the current version number for a stream within a specific partition.
§Parameters
stream_id: Stream identifier to get version forpartition_key: UUID to check specific partition
§Example
let partition_key = Uuid::parse_str("550e8400-e29b-41d4-a716-446655440000")?;
let version = conn.esver_with_partition_key("my-stream", partition_key)?;§Returns
Returns the current version number for the stream in the specified partition.
Sourcefn esub<'a, S: ToRedisArgs>(stream_id: S) -> Self
fn esub<'a, S: ToRedisArgs>(stream_id: S) -> Self
Sourcefn esub_with_partition_key<'a, S: ToRedisArgs>(
stream_id: S,
partition_key: Uuid,
) -> Self
fn esub_with_partition_key<'a, S: ToRedisArgs>( stream_id: S, partition_key: Uuid, ) -> Self
Subscribe to events from a stream with partition key.
§Parameters
stream_id: Stream identifier to subscribe topartition_key: UUID to subscribe to specific partition
§Example
let partition_key = Uuid::parse_str("550e8400-e29b-41d4-a716-446655440000")?;
let subscription = conn.esub_with_partition_key("my-stream", partition_key)?;§Returns
Returns subscription information.
Sourcefn esub_from_version<'a, S: ToRedisArgs>(
stream_id: S,
from_version: u64,
) -> Self
fn esub_from_version<'a, S: ToRedisArgs>( stream_id: S, from_version: u64, ) -> Self
Sourcefn esub_with_partition_and_version<'a, S: ToRedisArgs>(
stream_id: S,
partition_key: Uuid,
from_version: u64,
) -> Self
fn esub_with_partition_and_version<'a, S: ToRedisArgs>( stream_id: S, partition_key: Uuid, from_version: u64, ) -> Self
Subscribe to events from a stream with partition key and version.
§Parameters
stream_id: Stream identifier to subscribe topartition_key: UUID to subscribe to specific partitionfrom_version: Starting version number
§Example
let partition_key = Uuid::parse_str("550e8400-e29b-41d4-a716-446655440000")?;
let subscription = conn.esub_with_partition_and_version("my-stream", partition_key, 100)?;§Returns
Returns subscription information.
Sourcefn epsub_by_key<'a>(partition_key: Uuid) -> Self
fn epsub_by_key<'a>(partition_key: Uuid) -> Self
Subscribe to events from a partition by partition key.
§Parameters
partition_key: UUID key to determine which partition to subscribe to
§Example
let partition_key = Uuid::parse_str("550e8400-e29b-41d4-a716-446655440000")?;
let subscription = conn.epsub_by_key(partition_key)?;§Returns
Returns subscription information.
Sourcefn epsub_by_id<'a>(partition_id: u16) -> Self
fn epsub_by_id<'a>(partition_id: u16) -> Self
Sourcefn epsub_by_key_from_sequence<'a>(
partition_key: Uuid,
from_sequence: u64,
) -> Self
fn epsub_by_key_from_sequence<'a>( partition_key: Uuid, from_sequence: u64, ) -> Self
Subscribe to events from a partition by partition key, starting from a specific sequence.
§Parameters
partition_key: UUID key to determine which partition to subscribe tofrom_sequence: Start streaming from this sequence number
§Example
let partition_key = Uuid::parse_str("550e8400-e29b-41d4-a716-446655440000")?;
let subscription = conn.epsub_by_key_from_sequence(partition_key, 1000)?;§Returns
Returns subscription information.
Sourcefn epsub_by_id_from_sequence<'a>(partition_id: u16, from_sequence: u64) -> Self
fn epsub_by_id_from_sequence<'a>(partition_id: u16, from_sequence: u64) -> Self
Subscribe to events from a partition by partition ID, starting from a specific sequence.
§Parameters
partition_id: Numeric partition identifier (0-65535)from_sequence: Start streaming from this sequence number
§Example
let subscription = conn.epsub_by_id_from_sequence(42, 1000)?;§Returns
Returns subscription information.
Sourcefn eack<'a>(subscription_id: Uuid, cursor: u64) -> Self
fn eack<'a>(subscription_id: Uuid, cursor: u64) -> Self
Acknowledge events up to a specific cursor for a subscription.
§Parameters
subscription_id: UUID of the subscriptioncursor: Cursor number to acknowledge up to
§Example
let subscription_id = Uuid::parse_str("550e8400-e29b-41d4-a716-446655440000")?;
conn.eack(subscription_id, 100)?;§Returns
Returns “OK” on success.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl CmdExt for Cmd
impl CmdExt for Cmd
Source§fn eappend<'a, S: ToRedisArgs, E: ToRedisArgs>(
stream_id: S,
event_name: E,
options: EAppendOptions<'a>,
) -> Self
fn eappend<'a, S: ToRedisArgs, E: ToRedisArgs>( stream_id: S, event_name: E, options: EAppendOptions<'a>, ) -> Self
Append an event to a stream.
§Parameters
stream_id: Stream identifier to append the event toevent_name: Name/type of the eventoptions: Configuration for optional parameters (event_id, partition_key, expected_version, payload, metadata)
§Example
let options = EAppendOptions::new()
.payload(br#"{"name":"john"}"#)
.metadata(br#"{"source":"api"}"#);
conn.eappend("my-stream", "UserCreated", options)?;§Returns
Returns an AppendInfo containing event metadata.
Source§fn emappend<'a>(partition_key: Uuid, events: &'a [EMAppendEvent<'a>]) -> Self
fn emappend<'a>(partition_key: Uuid, events: &'a [EMAppendEvent<'a>]) -> Self
Append multiple events to streams in a single transaction.
§Parameters
partition_key: UUID that determines which partition all events will be written toevents: Array of events to append, each with their own configuration
§Example
let events = [
EMAppendEvent::new("stream1", "EventA").payload(br#"{"data":"value1"}"#),
EMAppendEvent::new("stream2", "EventB").payload(br#"{"data":"value2"}"#),
];
conn.emappend(partition_key, &events)?;Note: All events are appended atomically in a single transaction.
§Returns
Returns transaction result information.
Source§fn epscan_by_key<'a>(
partition_key: Uuid,
start_sequence: u64,
end_sequence: Option<u64>,
count: Option<u64>,
) -> Self
fn epscan_by_key<'a>( partition_key: Uuid, start_sequence: u64, end_sequence: Option<u64>, count: Option<u64>, ) -> Self
Scan events in a partition by partition key.
§Parameters
partition_key: UUID key to determine which partition to scanstart_sequence: Starting sequence numberend_sequence: Ending sequence number (Nonemeans scan to end)count: Maximum number of events to return (defaults to 100)
§Example
let partition_key = Uuid::parse_str("550e8400-e29b-41d4-a716-446655440000")?;
let batch = conn.epscan_by_key(partition_key, 0, Some(100), Some(50))?;§Returns
Returns an EventBatch containing events and pagination info.
Source§fn epscan_by_id<'a>(
partition_id: u16,
start_sequence: u64,
end_sequence: Option<u64>,
count: Option<u64>,
) -> Self
fn epscan_by_id<'a>( partition_id: u16, start_sequence: u64, end_sequence: Option<u64>, count: Option<u64>, ) -> Self
Scan events in a partition by partition ID.
§Parameters
partition_id: Numeric partition identifier (0-65535)start_sequence: Starting sequence numberend_sequence: Ending sequence number (Nonemeans scan to end)count: Maximum number of events to return (defaults to 100)
§Example
let batch = conn.epscan_by_id(42, 100, Some(200), Some(50))?;§Returns
Returns an EventBatch containing events and pagination info.
Source§fn escan<'a>(
stream_id: &'a str,
start_version: u64,
end_version: Option<u64>,
count: Option<u64>,
) -> Self
fn escan<'a>( stream_id: &'a str, start_version: u64, end_version: Option<u64>, count: Option<u64>, ) -> Self
Scan events in a stream by stream ID.
§Parameters
stream_id: Stream identifier to scanstart_version: Starting version numberend_version: Ending version number (Nonemeans scan to end)count: Maximum number of events to return (defaults to 100)
§Example
let events = conn.escan("my-stream", 0, Some(100), Some(50))?;§Returns
Returns events from the stream across all partitions.
Source§fn escan_with_partition_key<'a>(
stream_id: &'a str,
partition_key: Uuid,
start_version: u64,
end_version: Option<u64>,
count: Option<u64>,
) -> Self
fn escan_with_partition_key<'a>( stream_id: &'a str, partition_key: Uuid, start_version: u64, end_version: Option<u64>, count: Option<u64>, ) -> Self
Scan events in a stream by stream ID within a specific partition.
§Parameters
stream_id: Stream identifier to scanpartition_key: UUID to scan within a specific partition onlystart_version: Starting version numberend_version: Ending version number (Nonemeans scan to end)count: Maximum number of events to return (defaults to 100)
§Example
let partition_key = Uuid::parse_str("550e8400-e29b-41d4-a716-446655440000")?;
let batch = conn.escan_with_partition_key("my-stream", partition_key, 0, Some(100), Some(50))?;§Returns
Returns an EventBatch containing events from the specified partition only.
Source§fn epseq_by_key<'a>(partition_key: Uuid) -> Self
fn epseq_by_key<'a>(partition_key: Uuid) -> Self
Get the current sequence number for a partition by partition key.
§Parameters
partition_key: UUID key to determine which partition to query
§Example
let partition_key = Uuid::parse_str("550e8400-e29b-41d4-a716-446655440000")?;
let sequence = conn.epseq_by_key(partition_key)?;§Returns
Returns the current sequence number for the partition.
Source§fn epseq_by_id<'a>(partition_id: u16) -> Self
fn epseq_by_id<'a>(partition_id: u16) -> Self
Source§fn esver_with_partition_key<'a>(stream_id: &'a str, partition_key: Uuid) -> Self
fn esver_with_partition_key<'a>(stream_id: &'a str, partition_key: Uuid) -> Self
Get the current version number for a stream within a specific partition.
§Parameters
stream_id: Stream identifier to get version forpartition_key: UUID to check specific partition
§Example
let partition_key = Uuid::parse_str("550e8400-e29b-41d4-a716-446655440000")?;
let version = conn.esver_with_partition_key("my-stream", partition_key)?;§Returns
Returns the current version number for the stream in the specified partition.
Source§fn esub<'a, S: ToRedisArgs>(stream_id: S) -> Self
fn esub<'a, S: ToRedisArgs>(stream_id: S) -> Self
Source§fn esub_with_partition_key<'a, S: ToRedisArgs>(
stream_id: S,
partition_key: Uuid,
) -> Self
fn esub_with_partition_key<'a, S: ToRedisArgs>( stream_id: S, partition_key: Uuid, ) -> Self
Subscribe to events from a stream with partition key.
§Parameters
stream_id: Stream identifier to subscribe topartition_key: UUID to subscribe to specific partition
§Example
let partition_key = Uuid::parse_str("550e8400-e29b-41d4-a716-446655440000")?;
let subscription = conn.esub_with_partition_key("my-stream", partition_key)?;§Returns
Returns subscription information.
Source§fn esub_from_version<'a, S: ToRedisArgs>(
stream_id: S,
from_version: u64,
) -> Self
fn esub_from_version<'a, S: ToRedisArgs>( stream_id: S, from_version: u64, ) -> Self
Source§fn esub_with_partition_and_version<'a, S: ToRedisArgs>(
stream_id: S,
partition_key: Uuid,
from_version: u64,
) -> Self
fn esub_with_partition_and_version<'a, S: ToRedisArgs>( stream_id: S, partition_key: Uuid, from_version: u64, ) -> Self
Subscribe to events from a stream with partition key and version.
§Parameters
stream_id: Stream identifier to subscribe topartition_key: UUID to subscribe to specific partitionfrom_version: Starting version number
§Example
let partition_key = Uuid::parse_str("550e8400-e29b-41d4-a716-446655440000")?;
let subscription = conn.esub_with_partition_and_version("my-stream", partition_key, 100)?;§Returns
Returns subscription information.
Source§fn epsub_by_key<'a>(partition_key: Uuid) -> Self
fn epsub_by_key<'a>(partition_key: Uuid) -> Self
Subscribe to events from a partition by partition key.
§Parameters
partition_key: UUID key to determine which partition to subscribe to
§Example
let partition_key = Uuid::parse_str("550e8400-e29b-41d4-a716-446655440000")?;
let subscription = conn.epsub_by_key(partition_key)?;§Returns
Returns subscription information.
Source§fn epsub_by_id<'a>(partition_id: u16) -> Self
fn epsub_by_id<'a>(partition_id: u16) -> Self
Source§fn epsub_by_key_from_sequence<'a>(
partition_key: Uuid,
from_sequence: u64,
) -> Self
fn epsub_by_key_from_sequence<'a>( partition_key: Uuid, from_sequence: u64, ) -> Self
Subscribe to events from a partition by partition key, starting from a specific sequence.
§Parameters
partition_key: UUID key to determine which partition to subscribe tofrom_sequence: Start streaming from this sequence number
§Example
let partition_key = Uuid::parse_str("550e8400-e29b-41d4-a716-446655440000")?;
let subscription = conn.epsub_by_key_from_sequence(partition_key, 1000)?;§Returns
Returns subscription information.
Source§fn epsub_by_id_from_sequence<'a>(partition_id: u16, from_sequence: u64) -> Self
fn epsub_by_id_from_sequence<'a>(partition_id: u16, from_sequence: u64) -> Self
Subscribe to events from a partition by partition ID, starting from a specific sequence.
§Parameters
partition_id: Numeric partition identifier (0-65535)from_sequence: Start streaming from this sequence number
§Example
let subscription = conn.epsub_by_id_from_sequence(42, 1000)?;§Returns
Returns subscription information.
Source§fn eack<'a>(subscription_id: Uuid, cursor: u64) -> Self
fn eack<'a>(subscription_id: Uuid, cursor: u64) -> Self
Acknowledge events up to a specific cursor for a subscription.
§Parameters
subscription_id: UUID of the subscriptioncursor: Cursor number to acknowledge up to
§Example
let subscription_id = Uuid::parse_str("550e8400-e29b-41d4-a716-446655440000")?;
conn.eack(subscription_id, 100)?;§Returns
Returns “OK” on success.