From 88369d846097425de43f9d50cab4c9ae8bc4c059 Mon Sep 17 00:00:00 2001 From: Moritz Lang <16192401+slashmo@users.noreply.github.com> Date: Thu, 21 Aug 2025 19:01:17 +0200 Subject: [PATCH] Add static name to Valkey commands Signed-off-by: Moritz Lang <16192401+slashmo@users.noreply.github.com> --- Sources/Valkey/Commands/BitmapCommands.swift | 14 ++ Sources/Valkey/Commands/ClusterCommands.swift | 64 ++++++++ .../Valkey/Commands/ConnectionCommands.swift | 56 +++++++ Sources/Valkey/Commands/GenericCommands.swift | 66 ++++++++ Sources/Valkey/Commands/GeoCommands.swift | 20 +++ Sources/Valkey/Commands/HashCommands.swift | 32 ++++ .../Valkey/Commands/HyperloglogCommands.swift | 6 + Sources/Valkey/Commands/ListCommands.swift | 44 ++++++ Sources/Valkey/Commands/PubsubCommands.swift | 28 ++++ .../Valkey/Commands/ScriptingCommands.swift | 44 ++++++ .../Valkey/Commands/SentinelCommands.swift | 50 ++++++ Sources/Valkey/Commands/ServerCommands.swift | 142 ++++++++++++++++++ Sources/Valkey/Commands/SetCommands.swift | 34 +++++ .../Valkey/Commands/SortedSetCommands.swift | 70 +++++++++ Sources/Valkey/Commands/StreamCommands.swift | 46 ++++++ Sources/Valkey/Commands/StringCommands.swift | 44 ++++++ .../Commands/TransactionsCommands.swift | 10 ++ Sources/Valkey/ValkeyCommand.swift | 6 + Sources/ValkeyBloom/BloomCommands.swift | 18 +++ Sources/ValkeyJSON/JsonCommands.swift | 46 ++++++ .../ValkeyCommandsRender.swift | 2 + Tests/IntegrationTests/ValkeyTests.swift | 2 + 22 files changed, 844 insertions(+) diff --git a/Sources/Valkey/Commands/BitmapCommands.swift b/Sources/Valkey/Commands/BitmapCommands.swift index 0f3abefe..7cdbe6dd 100644 --- a/Sources/Valkey/Commands/BitmapCommands.swift +++ b/Sources/Valkey/Commands/BitmapCommands.swift @@ -82,6 +82,8 @@ public struct BITCOUNT: ValkeyCommand { } public typealias Response = Int + @inlinable public static var name: String { "BITCOUNT" } + public var key: ValkeyKey public var range: Range? @@ -247,6 +249,8 @@ public struct BITFIELD: ValkeyCommand { } public typealias Response = RESPToken.Array + @inlinable public static var name: String { "BITFIELD" } + public var key: ValkeyKey public var operations: [Operation] @@ -287,6 +291,8 @@ public struct BITFIELDRO: ValkeyCommand { } public typealias Response = [Int] + @inlinable public static var name: String { "BITFIELD_RO" } + public var key: ValkeyKey public var getBlocks: [GetBlock] @@ -328,6 +334,8 @@ public struct BITOP: ValkeyCommand { } public typealias Response = Int + @inlinable public static var name: String { "BITOP" } + public var operation: Operation public var destkey: ValkeyKey public var keys: [ValkeyKey] @@ -405,6 +413,8 @@ public struct BITPOS: ValkeyCommand { } public typealias Response = Int + @inlinable public static var name: String { "BITPOS" } + public var key: ValkeyKey public var bit: Int public var range: Range? @@ -429,6 +439,8 @@ public struct BITPOS: ValkeyCommand { public struct GETBIT: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "GETBIT" } + public var key: ValkeyKey public var offset: Int @@ -451,6 +463,8 @@ public struct GETBIT: ValkeyCommand { public struct SETBIT: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "SETBIT" } + public var key: ValkeyKey public var offset: Int public var value: Int diff --git a/Sources/Valkey/Commands/ClusterCommands.swift b/Sources/Valkey/Commands/ClusterCommands.swift index 3a43f641..c3dc59c4 100644 --- a/Sources/Valkey/Commands/ClusterCommands.swift +++ b/Sources/Valkey/Commands/ClusterCommands.swift @@ -28,6 +28,8 @@ public enum CLUSTER { /// Assigns new hash slots to a node. @_documentation(visibility: internal) public struct ADDSLOTS: ValkeyCommand { + @inlinable public static var name: String { "CLUSTER ADDSLOTS" } + public var slots: [Int] @inlinable public init(slots: [Int]) { @@ -62,6 +64,8 @@ public enum CLUSTER { endSlot.encode(into: &commandEncoder) } } + @inlinable public static var name: String { "CLUSTER ADDSLOTSRANGE" } + public var ranges: [Range] @inlinable public init(ranges: [Range]) { @@ -78,6 +82,8 @@ public enum CLUSTER { public struct BUMPEPOCH: ValkeyCommand { public typealias Response = ByteBuffer + @inlinable public static var name: String { "CLUSTER BUMPEPOCH" } + @inlinable public init() { } @@ -91,6 +97,8 @@ public enum CLUSTER { public struct COUNTFAILUREREPORTS: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "CLUSTER COUNT-FAILURE-REPORTS" } + public var nodeId: NodeId @inlinable public init(nodeId: NodeId) { @@ -107,6 +115,8 @@ public enum CLUSTER { public struct COUNTKEYSINSLOT: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "CLUSTER COUNTKEYSINSLOT" } + public var slot: Int @inlinable public init(slot: Int) { @@ -121,6 +131,8 @@ public enum CLUSTER { /// Sets hash slots as unbound for a node. @_documentation(visibility: internal) public struct DELSLOTS: ValkeyCommand { + @inlinable public static var name: String { "CLUSTER DELSLOTS" } + public var slots: [Int] @inlinable public init(slots: [Int]) { @@ -155,6 +167,8 @@ public enum CLUSTER { endSlot.encode(into: &commandEncoder) } } + @inlinable public static var name: String { "CLUSTER DELSLOTSRANGE" } + public var ranges: [Range] @inlinable public init(ranges: [Range]) { @@ -184,6 +198,8 @@ public enum CLUSTER { } } } + @inlinable public static var name: String { "CLUSTER FAILOVER" } + public var options: Options? @inlinable public init(options: Options? = nil) { @@ -198,6 +214,8 @@ public enum CLUSTER { /// Deletes all slots information from a node. @_documentation(visibility: internal) public struct FLUSHSLOTS: ValkeyCommand { + @inlinable public static var name: String { "CLUSTER FLUSHSLOTS" } + @inlinable public init() { } @@ -209,6 +227,8 @@ public enum CLUSTER { /// Removes a node from the nodes table. @_documentation(visibility: internal) public struct FORGET: ValkeyCommand { + @inlinable public static var name: String { "CLUSTER FORGET" } + public var nodeId: NodeId @inlinable public init(nodeId: NodeId) { @@ -225,6 +245,8 @@ public enum CLUSTER { public struct GETKEYSINSLOT: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "CLUSTER GETKEYSINSLOT" } + public var slot: Int public var count: Int @@ -243,6 +265,8 @@ public enum CLUSTER { public struct HELP: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "CLUSTER HELP" } + @inlinable public init() { } @@ -256,6 +280,8 @@ public enum CLUSTER { public struct INFO: ValkeyCommand { public typealias Response = ByteBuffer + @inlinable public static var name: String { "CLUSTER INFO" } + @inlinable public init() { } @@ -269,6 +295,8 @@ public enum CLUSTER { public struct KEYSLOT: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "CLUSTER KEYSLOT" } + public var key: Key @inlinable public init(_ key: Key) { @@ -285,6 +313,8 @@ public enum CLUSTER { public struct LINKS: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "CLUSTER LINKS" } + @inlinable public init() { } @@ -296,6 +326,8 @@ public enum CLUSTER { /// Forces a node to handshake with another node. @_documentation(visibility: internal) public struct MEET: ValkeyCommand { + @inlinable public static var name: String { "CLUSTER MEET" } + public var ip: Ip public var port: Int public var clusterBusPort: Int? @@ -316,6 +348,8 @@ public enum CLUSTER { public struct MYID: ValkeyCommand { public typealias Response = ByteBuffer + @inlinable public static var name: String { "CLUSTER MYID" } + @inlinable public init() { } @@ -329,6 +363,8 @@ public enum CLUSTER { public struct MYSHARDID: ValkeyCommand { public typealias Response = ByteBuffer + @inlinable public static var name: String { "CLUSTER MYSHARDID" } + @inlinable public init() { } @@ -342,6 +378,8 @@ public enum CLUSTER { public struct NODES: ValkeyCommand { public typealias Response = ByteBuffer + @inlinable public static var name: String { "CLUSTER NODES" } + @inlinable public init() { } @@ -355,6 +393,8 @@ public enum CLUSTER { public struct REPLICAS: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "CLUSTER REPLICAS" } + public var nodeId: NodeId @inlinable public init(nodeId: NodeId) { @@ -369,6 +409,8 @@ public enum CLUSTER { /// Configure a node as replica of a primary node. @_documentation(visibility: internal) public struct REPLICATE: ValkeyCommand { + @inlinable public static var name: String { "CLUSTER REPLICATE" } + public var nodeId: NodeId @inlinable public init(nodeId: NodeId) { @@ -398,6 +440,8 @@ public enum CLUSTER { } } } + @inlinable public static var name: String { "CLUSTER RESET" } + public var resetType: ResetType? @inlinable public init(resetType: ResetType? = nil) { @@ -412,6 +456,8 @@ public enum CLUSTER { /// Forces a node to save the cluster configuration to disk. @_documentation(visibility: internal) public struct SAVECONFIG: ValkeyCommand { + @inlinable public static var name: String { "CLUSTER SAVECONFIG" } + @inlinable public init() { } @@ -423,6 +469,8 @@ public enum CLUSTER { /// Sets the configuration epoch for a new node. @_documentation(visibility: internal) public struct SETCONFIGEPOCH: ValkeyCommand { + @inlinable public static var name: String { "CLUSTER SET-CONFIG-EPOCH" } + public var configEpoch: Int @inlinable public init(configEpoch: Int) { @@ -463,6 +511,8 @@ public enum CLUSTER { } } } + @inlinable public static var name: String { "CLUSTER SETSLOT" } + public var slot: Int public var subcommand: Subcommand public var timeout: Int? @@ -481,6 +531,8 @@ public enum CLUSTER { /// Returns the mapping of cluster slots to shards. @_documentation(visibility: internal) public struct SHARDS: ValkeyCommand { + @inlinable public static var name: String { "CLUSTER SHARDS" } + @inlinable public init() { } @@ -494,6 +546,8 @@ public enum CLUSTER { public struct SLAVES: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "CLUSTER SLAVES" } + public var nodeId: NodeId @inlinable public init(nodeId: NodeId) { @@ -588,6 +642,8 @@ public enum CLUSTER { } public typealias Response = RESPToken.Array + @inlinable public static var name: String { "CLUSTER SLOT-STATS" } + public var filter: Filter @inlinable public init(filter: Filter) { @@ -604,6 +660,8 @@ public enum CLUSTER { public struct SLOTS: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "CLUSTER SLOTS" } + @inlinable public init() { } @@ -617,6 +675,8 @@ public enum CLUSTER { /// Signals that a cluster client is following an -ASK redirect. @_documentation(visibility: internal) public struct ASKING: ValkeyCommand { + @inlinable public static var name: String { "ASKING" } + @inlinable public init() { } @@ -628,6 +688,8 @@ public struct ASKING: ValkeyCommand { /// Enables read-only queries for a connection to a Valkey replica node. @_documentation(visibility: internal) public struct READONLY: ValkeyCommand { + @inlinable public static var name: String { "READONLY" } + @inlinable public init() { } @@ -639,6 +701,8 @@ public struct READONLY: ValkeyCommand { /// Enables read-write queries for a connection to a Valkey replica node. @_documentation(visibility: internal) public struct READWRITE: ValkeyCommand { + @inlinable public static var name: String { "READWRITE" } + @inlinable public init() { } diff --git a/Sources/Valkey/Commands/ConnectionCommands.swift b/Sources/Valkey/Commands/ConnectionCommands.swift index 20d91653..511f07b3 100644 --- a/Sources/Valkey/Commands/ConnectionCommands.swift +++ b/Sources/Valkey/Commands/ConnectionCommands.swift @@ -41,6 +41,8 @@ extension CLIENT { } } } + @inlinable public static var name: String { "CLIENT CACHING" } + public var mode: Mode @inlinable public init(mode: Mode) { @@ -55,6 +57,8 @@ extension CLIENT { /// A client claims its capability. @_documentation(visibility: internal) public struct CAPA: ValkeyCommand { + @inlinable public static var name: String { "CLIENT CAPA" } + public var capabilities: [Capability] @inlinable public init(capabilities: [Capability]) { @@ -71,6 +75,8 @@ extension CLIENT { public struct GETNAME: ValkeyCommand { public typealias Response = ByteBuffer? + @inlinable public static var name: String { "CLIENT GETNAME" } + @inlinable public init() { } @@ -84,6 +90,8 @@ extension CLIENT { public struct GETREDIR: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "CLIENT GETREDIR" } + @inlinable public init() { } @@ -97,6 +105,8 @@ extension CLIENT { public struct HELP: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "CLIENT HELP" } + @inlinable public init() { } @@ -110,6 +120,8 @@ extension CLIENT { public struct ID: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "CLIENT ID" } + @inlinable public init() { } @@ -136,6 +148,8 @@ extension CLIENT { } } } + @inlinable public static var name: String { "CLIENT IMPORT-SOURCE" } + public var enabled: Enabled @inlinable public init(enabled: Enabled) { @@ -152,6 +166,8 @@ extension CLIENT { public struct INFO: ValkeyCommand { public typealias Response = ByteBuffer + @inlinable public static var name: String { "CLIENT INFO" } + @inlinable public init() { } @@ -258,6 +274,8 @@ extension CLIENT { } public typealias Response = Int? + @inlinable public static var name: String { "CLIENT KILL" } + public var filter: Filter @inlinable public init(filter: Filter) { @@ -308,6 +326,8 @@ extension CLIENT { } public typealias Response = ByteBuffer + @inlinable public static var name: String { "CLIENT LIST" } + public var clientType: ClientType? public var clientIds: [Int] public var username: String? @@ -367,6 +387,8 @@ extension CLIENT { } } } + @inlinable public static var name: String { "CLIENT NO-EVICT" } + public var enabled: Enabled @inlinable public init(enabled: Enabled) { @@ -396,6 +418,8 @@ extension CLIENT { } } } + @inlinable public static var name: String { "CLIENT NO-TOUCH" } + public var enabled: Enabled @inlinable public init(enabled: Enabled) { @@ -425,6 +449,8 @@ extension CLIENT { } } } + @inlinable public static var name: String { "CLIENT PAUSE" } + public var timeout: Int public var mode: Mode? @@ -458,6 +484,8 @@ extension CLIENT { } } } + @inlinable public static var name: String { "CLIENT REPLY" } + public var action: Action @inlinable public init(action: Action) { @@ -492,6 +520,8 @@ extension CLIENT { } } } + @inlinable public static var name: String { "CLIENT SETINFO" } + public var attr: Attr @inlinable public init(attr: Attr) { @@ -506,6 +536,8 @@ extension CLIENT { /// Sets the connection name. @_documentation(visibility: internal) public struct SETNAME: ValkeyCommand { + @inlinable public static var name: String { "CLIENT SETNAME" } + public var connectionName: ConnectionName @inlinable public init(connectionName: ConnectionName) { @@ -535,6 +567,8 @@ extension CLIENT { } } } + @inlinable public static var name: String { "CLIENT TRACKING" } + public var status: Status public var clientId: Int? public var prefixes: [String] @@ -581,6 +615,8 @@ extension CLIENT { public struct TRACKINGINFO: ValkeyCommand { public typealias Response = RESPToken.Map + @inlinable public static var name: String { "CLIENT TRACKINGINFO" } + @inlinable public init() { } @@ -609,6 +645,8 @@ extension CLIENT { } public typealias Response = Int + @inlinable public static var name: String { "CLIENT UNBLOCK" } + public var clientId: Int public var unblockType: UnblockType? @@ -625,6 +663,8 @@ extension CLIENT { /// Resumes processing commands from paused clients. @_documentation(visibility: internal) public struct UNPAUSE: ValkeyCommand { + @inlinable public static var name: String { "CLIENT UNPAUSE" } + @inlinable public init() { } @@ -638,6 +678,8 @@ extension CLIENT { /// Authenticates the connection. @_documentation(visibility: internal) public struct AUTH: ValkeyCommand { + @inlinable public static var name: String { "AUTH" } + public var username: String? public var password: Password @@ -654,6 +696,8 @@ public struct AUTH: ValkeyCommand { /// A container for client connection commands. @_documentation(visibility: internal) public struct CLIENT: ValkeyCommand { + @inlinable public static var name: String { "CLIENT" } + @inlinable public init() { } @@ -667,6 +711,8 @@ public struct CLIENT: ValkeyCommand { public struct ECHO: ValkeyCommand { public typealias Response = ByteBuffer + @inlinable public static var name: String { "ECHO" } + public var message: Message @inlinable public init(message: Message) { @@ -726,6 +772,8 @@ public struct HELLO: ValkeyCommand { } public typealias Response = RESPToken.Map + @inlinable public static var name: String { "HELLO" } + public var arguments: Arguments? @inlinable public init(arguments: Arguments? = nil) { @@ -740,6 +788,8 @@ public struct HELLO: ValkeyCommand { /// Returns the server's liveliness response. @_documentation(visibility: internal) public struct PING: ValkeyCommand { + @inlinable public static var name: String { "PING" } + public var message: String? @inlinable public init(message: String? = nil) { @@ -754,6 +804,8 @@ public struct PING: ValkeyCommand { /// Closes the connection. @_documentation(visibility: internal) public struct QUIT: ValkeyCommand { + @inlinable public static var name: String { "QUIT" } + @inlinable public init() { } @@ -767,6 +819,8 @@ public struct QUIT: ValkeyCommand { public struct RESET: ValkeyCommand { public typealias Response = String + @inlinable public static var name: String { "RESET" } + @inlinable public init() { } @@ -778,6 +832,8 @@ public struct RESET: ValkeyCommand { /// Changes the selected database. @_documentation(visibility: internal) public struct SELECT: ValkeyCommand { + @inlinable public static var name: String { "SELECT" } + public var index: Int @inlinable public init(index: Int) { diff --git a/Sources/Valkey/Commands/GenericCommands.swift b/Sources/Valkey/Commands/GenericCommands.swift index c1e1e390..80aeee4c 100644 --- a/Sources/Valkey/Commands/GenericCommands.swift +++ b/Sources/Valkey/Commands/GenericCommands.swift @@ -30,6 +30,8 @@ public enum OBJECT { public struct ENCODING: ValkeyCommand { public typealias Response = ByteBuffer? + @inlinable public static var name: String { "OBJECT ENCODING" } + public var key: ValkeyKey @inlinable public init(_ key: ValkeyKey) { @@ -50,6 +52,8 @@ public enum OBJECT { public struct FREQ: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "OBJECT FREQ" } + public var key: ValkeyKey @inlinable public init(_ key: ValkeyKey) { @@ -70,6 +74,8 @@ public enum OBJECT { public struct HELP: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "OBJECT HELP" } + @inlinable public init() { } @@ -83,6 +89,8 @@ public enum OBJECT { public struct IDLETIME: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "OBJECT IDLETIME" } + public var key: ValkeyKey @inlinable public init(_ key: ValkeyKey) { @@ -103,6 +111,8 @@ public enum OBJECT { public struct REFCOUNT: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "OBJECT REFCOUNT" } + public var key: ValkeyKey @inlinable public init(_ key: ValkeyKey) { @@ -125,6 +135,8 @@ public enum OBJECT { public struct COPY: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "COPY" } + public var source: ValkeyKey public var destination: ValkeyKey public var destinationDb: Int? @@ -149,6 +161,8 @@ public struct COPY: ValkeyCommand { public struct DEL: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "DEL" } + public var keys: [ValkeyKey] @inlinable public init(keys: [ValkeyKey]) { @@ -167,6 +181,8 @@ public struct DEL: ValkeyCommand { public struct DUMP: ValkeyCommand { public typealias Response = ByteBuffer? + @inlinable public static var name: String { "DUMP" } + public var key: ValkeyKey @inlinable public init(_ key: ValkeyKey) { @@ -187,6 +203,8 @@ public struct DUMP: ValkeyCommand { public struct EXISTS: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "EXISTS" } + public var keys: [ValkeyKey] @inlinable public init(keys: [ValkeyKey]) { @@ -226,6 +244,8 @@ public struct EXPIRE: ValkeyCommand { } public typealias Response = Int + @inlinable public static var name: String { "EXPIRE" } + public var key: ValkeyKey public var seconds: Int public var condition: Condition? @@ -267,6 +287,8 @@ public struct EXPIREAT: ValkeyCommand { } public typealias Response = Int + @inlinable public static var name: String { "EXPIREAT" } + public var key: ValkeyKey public var unixTimeSeconds: Date public var condition: Condition? @@ -289,6 +311,8 @@ public struct EXPIREAT: ValkeyCommand { public struct EXPIRETIME: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "EXPIRETIME" } + public var key: ValkeyKey @inlinable public init(_ key: ValkeyKey) { @@ -309,6 +333,8 @@ public struct EXPIRETIME: ValkeyCommand { public struct KEYS: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "KEYS" } + public var pattern: String @inlinable public init(pattern: String) { @@ -387,6 +413,8 @@ public struct MIGRATE: ValkeyCommand { } public typealias Response = String? + @inlinable public static var name: String { "MIGRATE" } + public var host: Host public var port: Int public var keySelector: KeySelector @@ -442,6 +470,8 @@ public struct MIGRATE: ValkeyCommand { public struct MOVE: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "MOVE" } + public var key: ValkeyKey public var db: Int @@ -462,6 +492,8 @@ public struct MOVE: ValkeyCommand { public struct PERSIST: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "PERSIST" } + public var key: ValkeyKey @inlinable public init(_ key: ValkeyKey) { @@ -499,6 +531,8 @@ public struct PEXPIRE: ValkeyCommand { } public typealias Response = Int + @inlinable public static var name: String { "PEXPIRE" } + public var key: ValkeyKey public var milliseconds: Int public var condition: Condition? @@ -540,6 +574,8 @@ public struct PEXPIREAT: ValkeyCommand { } public typealias Response = Int + @inlinable public static var name: String { "PEXPIREAT" } + public var key: ValkeyKey public var unixTimeMilliseconds: Date public var condition: Condition? @@ -562,6 +598,8 @@ public struct PEXPIREAT: ValkeyCommand { public struct PEXPIRETIME: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "PEXPIRETIME" } + public var key: ValkeyKey @inlinable public init(_ key: ValkeyKey) { @@ -582,6 +620,8 @@ public struct PEXPIRETIME: ValkeyCommand { public struct PTTL: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "PTTL" } + public var key: ValkeyKey @inlinable public init(_ key: ValkeyKey) { @@ -602,6 +642,8 @@ public struct PTTL: ValkeyCommand { public struct RANDOMKEY: ValkeyCommand { public typealias Response = ByteBuffer? + @inlinable public static var name: String { "RANDOMKEY" } + @inlinable public init() { } @@ -615,6 +657,8 @@ public struct RANDOMKEY: ValkeyCommand { /// Renames a key and overwrites the destination. @_documentation(visibility: internal) public struct RENAME: ValkeyCommand { + @inlinable public static var name: String { "RENAME" } + public var key: ValkeyKey public var newkey: ValkeyKey @@ -635,6 +679,8 @@ public struct RENAME: ValkeyCommand { public struct RENAMENX: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "RENAMENX" } + public var key: ValkeyKey public var newkey: ValkeyKey @@ -653,6 +699,8 @@ public struct RENAMENX: ValkeyCommand { /// Creates a key from the serialized representation of a value. @_documentation(visibility: internal) public struct RESTORE: ValkeyCommand { + @inlinable public static var name: String { "RESTORE" } + public var key: ValkeyKey public var ttl: Int public var serializedValue: SerializedValue @@ -700,6 +748,8 @@ public struct RESTORE: ValkeyCommand { public struct SCAN: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "SCAN" } + public var cursor: Int public var pattern: String? public var count: Int? @@ -757,6 +807,8 @@ public struct SORT: ValkeyCommand { } } } + @inlinable public static var name: String { "SORT" } + public var key: ValkeyKey public var byPattern: String? public var limit: Limit? @@ -839,6 +891,8 @@ public struct SORTRO: ValkeyCommand { } public typealias Response = RESPToken.Array + @inlinable public static var name: String { "SORT_RO" } + public var key: ValkeyKey public var byPattern: String? public var limit: Limit? @@ -884,6 +938,8 @@ public struct SORTRO: ValkeyCommand { public struct TOUCH: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "TOUCH" } + public var keys: [ValkeyKey] @inlinable public init(keys: [ValkeyKey]) { @@ -904,6 +960,8 @@ public struct TOUCH: ValkeyCommand { public struct TTL: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "TTL" } + public var key: ValkeyKey @inlinable public init(_ key: ValkeyKey) { @@ -924,6 +982,8 @@ public struct TTL: ValkeyCommand { public struct TYPE: ValkeyCommand { public typealias Response = ByteBuffer? + @inlinable public static var name: String { "TYPE" } + public var key: ValkeyKey @inlinable public init(_ key: ValkeyKey) { @@ -944,6 +1004,8 @@ public struct TYPE: ValkeyCommand { public struct UNLINK: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "UNLINK" } + public var keys: [ValkeyKey] @inlinable public init(keys: [ValkeyKey]) { @@ -962,6 +1024,8 @@ public struct UNLINK: ValkeyCommand { public struct WAIT: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "WAIT" } + public var numreplicas: Int public var timeout: Int @@ -982,6 +1046,8 @@ public struct WAIT: ValkeyCommand { public struct WAITAOF: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "WAITAOF" } + public var numlocal: Int public var numreplicas: Int public var timeout: Int diff --git a/Sources/Valkey/Commands/GeoCommands.swift b/Sources/Valkey/Commands/GeoCommands.swift index ffb9522d..1e27760b 100644 --- a/Sources/Valkey/Commands/GeoCommands.swift +++ b/Sources/Valkey/Commands/GeoCommands.swift @@ -65,6 +65,8 @@ public struct GEOADD: ValkeyCommand { } public typealias Response = Int + @inlinable public static var name: String { "GEOADD" } + public var key: ValkeyKey public var condition: Condition? public var change: Bool @@ -106,6 +108,8 @@ public struct GEODIST: ValkeyCommand { } } } + @inlinable public static var name: String { "GEORADIUSBYMEMBER" } + public var key: ValkeyKey public var member: Member public var radius: Double @@ -494,6 +506,8 @@ public struct GEORADIUSBYMEMBERRO: ValkeyCommand { } public typealias Response = RESPToken.Array + @inlinable public static var name: String { "GEORADIUSBYMEMBER_RO" } + public var key: ValkeyKey public var member: Member public var radius: Double @@ -605,6 +619,8 @@ public struct GEORADIUSRO: ValkeyCommand { } public typealias Response = RESPToken.Array + @inlinable public static var name: String { "GEORADIUS_RO" } + public var key: ValkeyKey public var longitude: Double public var latitude: Double @@ -840,6 +856,8 @@ public struct GEOSEARCH: ValkeyCommand { RESPPureToken("ANY", any).encode(into: &commandEncoder) } } + @inlinable public static var name: String { "GEOSEARCH" } + public var key: ValkeyKey public var from: From public var by: By @@ -1069,6 +1087,8 @@ public struct GEOSEARCHSTORE: ValkeyCommand { } public typealias Response = Int + @inlinable public static var name: String { "GEOSEARCHSTORE" } + public var destination: ValkeyKey public var source: ValkeyKey public var from: From diff --git a/Sources/Valkey/Commands/HashCommands.swift b/Sources/Valkey/Commands/HashCommands.swift index 0ab968ee..f395b6c2 100644 --- a/Sources/Valkey/Commands/HashCommands.swift +++ b/Sources/Valkey/Commands/HashCommands.swift @@ -27,6 +27,8 @@ import Foundation public struct HDEL: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "HDEL" } + public var key: ValkeyKey public var fields: [Field] @@ -47,6 +49,8 @@ public struct HDEL: ValkeyCommand { public struct HEXISTS: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "HEXISTS" } + public var key: ValkeyKey public var field: Field @@ -69,6 +73,8 @@ public struct HEXISTS: ValkeyCommand { public struct HGET: ValkeyCommand { public typealias Response = ByteBuffer? + @inlinable public static var name: String { "HGET" } + public var key: ValkeyKey public var field: Field @@ -91,6 +97,8 @@ public struct HGET: ValkeyCommand { public struct HGETALL: ValkeyCommand { public typealias Response = RESPToken.Map + @inlinable public static var name: String { "HGETALL" } + public var key: ValkeyKey @inlinable public init(_ key: ValkeyKey) { @@ -111,6 +119,8 @@ public struct HGETALL: ValkeyCommand { public struct HINCRBY: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "HINCRBY" } + public var key: ValkeyKey public var field: Field public var increment: Int @@ -133,6 +143,8 @@ public struct HINCRBY: ValkeyCommand { public struct HINCRBYFLOAT: ValkeyCommand { public typealias Response = ByteBuffer + @inlinable public static var name: String { "HINCRBYFLOAT" } + public var key: ValkeyKey public var field: Field public var increment: Double @@ -155,6 +167,8 @@ public struct HINCRBYFLOAT: ValkeyCommand { public struct HKEYS: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "HKEYS" } + public var key: ValkeyKey @inlinable public init(_ key: ValkeyKey) { @@ -175,6 +189,8 @@ public struct HKEYS: ValkeyCommand { public struct HLEN: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "HLEN" } + public var key: ValkeyKey @inlinable public init(_ key: ValkeyKey) { @@ -195,6 +211,8 @@ public struct HLEN: ValkeyCommand { public struct HMGET: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "HMGET" } + public var key: ValkeyKey public var fields: [Field] @@ -235,6 +253,8 @@ public struct HMSET: V RESPBulkString(value).encode(into: &commandEncoder) } } + @inlinable public static var name: String { "HMSET" } + public var key: ValkeyKey public var data: [Data] @@ -275,6 +295,8 @@ public struct HRANDFIELD: ValkeyCommand { } public typealias Response = RESPToken? + @inlinable public static var name: String { "HRANDFIELD" } + public var key: ValkeyKey public var options: Options? @@ -297,6 +319,8 @@ public struct HRANDFIELD: ValkeyCommand { public struct HSCAN: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "HSCAN" } + public var key: ValkeyKey public var cursor: Int public var pattern: String? @@ -352,6 +376,8 @@ public struct HSET: Va } public typealias Response = Int + @inlinable public static var name: String { "HSET" } + public var key: ValkeyKey public var data: [Data] @@ -372,6 +398,8 @@ public struct HSET: Va public struct HSETNX: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "HSETNX" } + public var key: ValkeyKey public var field: Field public var value: Value @@ -394,6 +422,8 @@ public struct HSETNX: public struct HSTRLEN: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "HSTRLEN" } + public var key: ValkeyKey public var field: Field @@ -416,6 +446,8 @@ public struct HSTRLEN: ValkeyCommand { public struct HVALS: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "HVALS" } + public var key: ValkeyKey @inlinable public init(_ key: ValkeyKey) { diff --git a/Sources/Valkey/Commands/HyperloglogCommands.swift b/Sources/Valkey/Commands/HyperloglogCommands.swift index c5d0ff83..e5827d8d 100644 --- a/Sources/Valkey/Commands/HyperloglogCommands.swift +++ b/Sources/Valkey/Commands/HyperloglogCommands.swift @@ -27,6 +27,8 @@ import Foundation public struct PFADD: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "PFADD" } + public var key: ValkeyKey public var elements: [String] @@ -47,6 +49,8 @@ public struct PFADD: ValkeyCommand { public struct PFCOUNT: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "PFCOUNT" } + public var keys: [ValkeyKey] @inlinable public init(keys: [ValkeyKey]) { @@ -65,6 +69,8 @@ public struct PFCOUNT: ValkeyCommand { /// Merges one or more HyperLogLog values into a single key. @_documentation(visibility: internal) public struct PFMERGE: ValkeyCommand { + @inlinable public static var name: String { "PFMERGE" } + public var destkey: ValkeyKey public var sourcekeys: [ValkeyKey] diff --git a/Sources/Valkey/Commands/ListCommands.swift b/Sources/Valkey/Commands/ListCommands.swift index 8860b472..cce1814b 100644 --- a/Sources/Valkey/Commands/ListCommands.swift +++ b/Sources/Valkey/Commands/ListCommands.swift @@ -57,6 +57,8 @@ public struct BLMOVE: ValkeyCommand { } public typealias Response = ByteBuffer? + @inlinable public static var name: String { "BLMOVE" } + public var source: ValkeyKey public var destination: ValkeyKey public var wherefrom: Wherefrom @@ -100,6 +102,8 @@ public struct BLMPOP: ValkeyCommand { } public typealias Response = RESPToken.Array? + @inlinable public static var name: String { "BLMPOP" } + public var timeout: Double public var keys: [ValkeyKey] public var `where`: Where @@ -126,6 +130,8 @@ public struct BLMPOP: ValkeyCommand { public struct BLPOP: ValkeyCommand { public typealias Response = RESPToken.Array? + @inlinable public static var name: String { "BLPOP" } + public var keys: [ValkeyKey] public var timeout: Double @@ -148,6 +154,8 @@ public struct BLPOP: ValkeyCommand { public struct BRPOP: ValkeyCommand { public typealias Response = RESPToken.Array? + @inlinable public static var name: String { "BRPOP" } + public var keys: [ValkeyKey] public var timeout: Double @@ -170,6 +178,8 @@ public struct BRPOP: ValkeyCommand { public struct BRPOPLPUSH: ValkeyCommand { public typealias Response = ByteBuffer? + @inlinable public static var name: String { "BRPOPLPUSH" } + public var source: ValkeyKey public var destination: ValkeyKey public var timeout: Double @@ -194,6 +204,8 @@ public struct BRPOPLPUSH: ValkeyCommand { public struct LINDEX: ValkeyCommand { public typealias Response = ByteBuffer? + @inlinable public static var name: String { "LINDEX" } + public var key: ValkeyKey public var index: Int @@ -231,6 +243,8 @@ public struct LINSERT: ValkeyCommand { public typealias Response = [Int]? + @inlinable public static var name: String { "LPOS" } + public var key: ValkeyKey public var element: Element public var rank: Int? @@ -419,6 +443,8 @@ public struct LPOS: ValkeyCommand { public struct LPUSH: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "LPUSH" } + public var key: ValkeyKey public var elements: [Element] @@ -439,6 +465,8 @@ public struct LPUSH: ValkeyCommand { public struct LPUSHX: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "LPUSHX" } + public var key: ValkeyKey public var elements: [Element] @@ -459,6 +487,8 @@ public struct LPUSHX: ValkeyCommand { public struct LRANGE: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "LRANGE" } + public var key: ValkeyKey public var start: Int public var stop: Int @@ -483,6 +513,8 @@ public struct LRANGE: ValkeyCommand { public struct LREM: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "LREM" } + public var key: ValkeyKey public var count: Int public var element: Element @@ -503,6 +535,8 @@ public struct LREM: ValkeyCommand { /// Sets the value of an element in a list by its index. @_documentation(visibility: internal) public struct LSET: ValkeyCommand { + @inlinable public static var name: String { "LSET" } + public var key: ValkeyKey public var index: Int public var element: Element @@ -523,6 +557,8 @@ public struct LSET: ValkeyCommand { /// Removes elements from both ends a list. Deletes the list if all elements were trimmed. @_documentation(visibility: internal) public struct LTRIM: ValkeyCommand { + @inlinable public static var name: String { "LTRIM" } + public var key: ValkeyKey public var start: Int public var stop: Int @@ -545,6 +581,8 @@ public struct LTRIM: ValkeyCommand { public struct RPOP: ValkeyCommand { public typealias Response = RESPToken? + @inlinable public static var name: String { "RPOP" } + public var key: ValkeyKey public var count: Int? @@ -565,6 +603,8 @@ public struct RPOP: ValkeyCommand { public struct RPOPLPUSH: ValkeyCommand { public typealias Response = ByteBuffer? + @inlinable public static var name: String { "RPOPLPUSH" } + public var source: ValkeyKey public var destination: ValkeyKey @@ -585,6 +625,8 @@ public struct RPOPLPUSH: ValkeyCommand { public struct RPUSH: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "RPUSH" } + public var key: ValkeyKey public var elements: [Element] @@ -605,6 +647,8 @@ public struct RPUSH: ValkeyCommand { public struct RPUSHX: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "RPUSHX" } + public var key: ValkeyKey public var elements: [Element] diff --git a/Sources/Valkey/Commands/PubsubCommands.swift b/Sources/Valkey/Commands/PubsubCommands.swift index f42f0c10..2f420552 100644 --- a/Sources/Valkey/Commands/PubsubCommands.swift +++ b/Sources/Valkey/Commands/PubsubCommands.swift @@ -30,6 +30,8 @@ public enum PUBSUB { public struct CHANNELS: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "PUBSUB CHANNELS" } + public var pattern: String? @inlinable public init(pattern: String? = nil) { @@ -46,6 +48,8 @@ public enum PUBSUB { public struct HELP: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "PUBSUB HELP" } + @inlinable public init() { } @@ -59,6 +63,8 @@ public enum PUBSUB { public struct NUMPAT: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "PUBSUB NUMPAT" } + @inlinable public init() { } @@ -72,6 +78,8 @@ public enum PUBSUB { public struct NUMSUB: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "PUBSUB NUMSUB" } + public var channels: [String] @inlinable public init(channels: [String] = []) { @@ -88,6 +96,8 @@ public enum PUBSUB { public struct SHARDCHANNELS: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "PUBSUB SHARDCHANNELS" } + public var pattern: String? @inlinable public init(pattern: String? = nil) { @@ -104,6 +114,8 @@ public enum PUBSUB { public struct SHARDNUMSUB: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "PUBSUB SHARDNUMSUB" } + public var shardchannels: [String] @inlinable public init(shardchannels: [String] = []) { @@ -120,6 +132,8 @@ public enum PUBSUB { /// Listens for messages published to channels that match one or more patterns. @_documentation(visibility: internal) public struct PSUBSCRIBE: ValkeyCommand { + @inlinable public static var name: String { "PSUBSCRIBE" } + public var patterns: [String] @inlinable public init(patterns: [String]) { @@ -136,6 +150,8 @@ public struct PSUBSCRIBE: ValkeyCommand { public struct PUBLISH: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "PUBLISH" } + public var channel: Channel public var message: Message @@ -152,6 +168,8 @@ public struct PUBLISH: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "SPUBLISH" } + public var shardchannel: Shardchannel public var message: Message @@ -184,6 +204,8 @@ public struct SPUBLISH: ValkeyCommand { + @inlinable public static var name: String { "SSUBSCRIBE" } + public var shardchannels: [Shardchannel] @inlinable public init(shardchannels: [Shardchannel]) { @@ -198,6 +220,8 @@ public struct SSUBSCRIBE: ValkeyCommand { /// Listens for messages published to channels. @_documentation(visibility: internal) public struct SUBSCRIBE: ValkeyCommand { + @inlinable public static var name: String { "SUBSCRIBE" } + public var channels: [Channel] @inlinable public init(channels: [Channel]) { @@ -212,6 +236,8 @@ public struct SUBSCRIBE: ValkeyCommand { /// Stops listening to messages posted to shard channels. @_documentation(visibility: internal) public struct SUNSUBSCRIBE: ValkeyCommand { + @inlinable public static var name: String { "SUNSUBSCRIBE" } + public var shardchannels: [String] @inlinable public init(shardchannels: [String] = []) { @@ -226,6 +252,8 @@ public struct SUNSUBSCRIBE: ValkeyCommand { /// Stops listening to messages posted to channels. @_documentation(visibility: internal) public struct UNSUBSCRIBE: ValkeyCommand { + @inlinable public static var name: String { "UNSUBSCRIBE" } + public var channels: [String] @inlinable public init(channels: [String] = []) { diff --git a/Sources/Valkey/Commands/ScriptingCommands.swift b/Sources/Valkey/Commands/ScriptingCommands.swift index 2eedf59d..7130fb57 100644 --- a/Sources/Valkey/Commands/ScriptingCommands.swift +++ b/Sources/Valkey/Commands/ScriptingCommands.swift @@ -28,6 +28,8 @@ public enum FUNCTION { /// Deletes a library and its functions. @_documentation(visibility: internal) public struct DELETE: ValkeyCommand { + @inlinable public static var name: String { "FUNCTION DELETE" } + public var libraryName: LibraryName @inlinable public init(libraryName: LibraryName) { @@ -44,6 +46,8 @@ public enum FUNCTION { public struct DUMP: ValkeyCommand { public typealias Response = ByteBuffer + @inlinable public static var name: String { "FUNCTION DUMP" } + @inlinable public init() { } @@ -70,6 +74,8 @@ public enum FUNCTION { } } } + @inlinable public static var name: String { "FUNCTION FLUSH" } + public var flushType: FlushType? @inlinable public init(flushType: FlushType? = nil) { @@ -86,6 +92,8 @@ public enum FUNCTION { public struct HELP: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "FUNCTION HELP" } + @inlinable public init() { } @@ -97,6 +105,8 @@ public enum FUNCTION { /// Terminates a function during execution. @_documentation(visibility: internal) public struct KILL: ValkeyCommand { + @inlinable public static var name: String { "FUNCTION KILL" } + @inlinable public init() { } @@ -110,6 +120,8 @@ public enum FUNCTION { public struct LIST: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "FUNCTION LIST" } + public var libraryNamePattern: String? public var withcode: Bool @@ -128,6 +140,8 @@ public enum FUNCTION { public struct LOAD: ValkeyCommand { public typealias Response = ByteBuffer + @inlinable public static var name: String { "FUNCTION LOAD" } + public var replace: Bool public var functionCode: FunctionCode @@ -161,6 +175,8 @@ public enum FUNCTION { } } } + @inlinable public static var name: String { "FUNCTION RESTORE" } + public var serializedValue: SerializedValue public var policy: Policy? @@ -179,6 +195,8 @@ public enum FUNCTION { public struct STATS: ValkeyCommand { public typealias Response = RESPToken.Map + @inlinable public static var name: String { "FUNCTION STATS" } + @inlinable public init() { } @@ -212,6 +230,8 @@ public enum SCRIPT { } } } + @inlinable public static var name: String { "SCRIPT DEBUG" } + public var mode: Mode @inlinable public init(mode: Mode) { @@ -228,6 +248,8 @@ public enum SCRIPT { public struct EXISTS: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "SCRIPT EXISTS" } + public var sha1s: [Sha1] @inlinable public init(sha1s: [Sha1]) { @@ -257,6 +279,8 @@ public enum SCRIPT { } } } + @inlinable public static var name: String { "SCRIPT FLUSH" } + public var flushType: FlushType? @inlinable public init(flushType: FlushType? = nil) { @@ -273,6 +297,8 @@ public enum SCRIPT { public struct HELP: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "SCRIPT HELP" } + @inlinable public init() { } @@ -284,6 +310,8 @@ public enum SCRIPT { /// Terminates a server-side Lua script during execution. @_documentation(visibility: internal) public struct KILL: ValkeyCommand { + @inlinable public static var name: String { "SCRIPT KILL" } + @inlinable public init() { } @@ -297,6 +325,8 @@ public enum SCRIPT { public struct LOAD: ValkeyCommand { public typealias Response = ByteBuffer + @inlinable public static var name: String { "SCRIPT LOAD" } + public var script: Script @inlinable public init(script: Script) { @@ -313,6 +343,8 @@ public enum SCRIPT { public struct SHOW: ValkeyCommand { public typealias Response = ByteBuffer + @inlinable public static var name: String { "SCRIPT SHOW" } + public var sha1: Sha1 @inlinable public init(sha1: Sha1) { @@ -329,6 +361,8 @@ public enum SCRIPT { /// Executes a server-side Lua script. @_documentation(visibility: internal) public struct EVAL: ValkeyCommand { + @inlinable public static var name: String { "EVAL" } + public var script: Script public var keys: [ValkeyKey] public var args: [String] @@ -349,6 +383,8 @@ public struct EVAL: ValkeyCommand { /// Executes a server-side Lua script by SHA1 digest. @_documentation(visibility: internal) public struct EVALSHA: ValkeyCommand { + @inlinable public static var name: String { "EVALSHA" } + public var sha1: Sha1 public var keys: [ValkeyKey] public var args: [String] @@ -369,6 +405,8 @@ public struct EVALSHA: ValkeyCommand { /// Executes a read-only server-side Lua script by SHA1 digest. @_documentation(visibility: internal) public struct EVALSHARO: ValkeyCommand { + @inlinable public static var name: String { "EVALSHA_RO" } + public var sha1: Sha1 public var keys: [ValkeyKey] public var args: [String] @@ -391,6 +429,8 @@ public struct EVALSHARO: ValkeyCommand { /// Executes a read-only server-side Lua script. @_documentation(visibility: internal) public struct EVALRO: ValkeyCommand { + @inlinable public static var name: String { "EVAL_RO" } + public var script: Script public var keys: [ValkeyKey] public var args: [String] @@ -413,6 +453,8 @@ public struct EVALRO: ValkeyCommand { /// Invokes a function. @_documentation(visibility: internal) public struct FCALL: ValkeyCommand { + @inlinable public static var name: String { "FCALL" } + public var function: Function public var keys: [ValkeyKey] public var args: [String] @@ -433,6 +475,8 @@ public struct FCALL: ValkeyCommand { /// Invokes a read-only function. @_documentation(visibility: internal) public struct FCALLRO: ValkeyCommand { + @inlinable public static var name: String { "FCALL_RO" } + public var function: Function public var keys: [ValkeyKey] public var args: [String] diff --git a/Sources/Valkey/Commands/SentinelCommands.swift b/Sources/Valkey/Commands/SentinelCommands.swift index 238a4a19..a93cb7ca 100644 --- a/Sources/Valkey/Commands/SentinelCommands.swift +++ b/Sources/Valkey/Commands/SentinelCommands.swift @@ -30,6 +30,8 @@ public enum SENTINEL { public struct CKQUORUM: ValkeyCommand { public typealias Response = ByteBuffer + @inlinable public static var name: String { "SENTINEL CKQUORUM" } + public var primaryName: PrimaryName @inlinable public init(primaryName: PrimaryName) { @@ -86,6 +88,8 @@ public enum SENTINEL { } public typealias Response = RESPToken.Map? + @inlinable public static var name: String { "SENTINEL CONFIG" } + public var action: Action @inlinable public init(action: Action) { @@ -122,6 +126,8 @@ public enum SENTINEL { } public typealias Response = RESPToken.Map? + @inlinable public static var name: String { "SENTINEL DEBUG" } + public var data: [Data] @inlinable public init(data: [Data] = []) { @@ -136,6 +142,8 @@ public enum SENTINEL { /// Forces a Sentinel failover. @_documentation(visibility: internal) public struct FAILOVER: ValkeyCommand { + @inlinable public static var name: String { "SENTINEL FAILOVER" } + public var primaryName: PrimaryName @inlinable public init(primaryName: PrimaryName) { @@ -150,6 +158,8 @@ public enum SENTINEL { /// Rewrites the Sentinel configuration file. @_documentation(visibility: internal) public struct FLUSHCONFIG: ValkeyCommand { + @inlinable public static var name: String { "SENTINEL FLUSHCONFIG" } + @inlinable public init() { } @@ -163,6 +173,8 @@ public enum SENTINEL { public struct GETMASTERADDRBYNAME: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "SENTINEL GET-MASTER-ADDR-BY-NAME" } + public var primaryName: PrimaryName @inlinable public init(primaryName: PrimaryName) { @@ -179,6 +191,8 @@ public enum SENTINEL { public struct GETPRIMARYADDRBYNAME: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "SENTINEL GET-PRIMARY-ADDR-BY-NAME" } + public var primaryName: PrimaryName @inlinable public init(primaryName: PrimaryName) { @@ -195,6 +209,8 @@ public enum SENTINEL { public struct HELP: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "SENTINEL HELP" } + @inlinable public init() { } @@ -208,6 +224,8 @@ public enum SENTINEL { public struct INFOCACHE: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "SENTINEL INFO-CACHE" } + public var nodenames: [Nodename] @inlinable public init(nodenames: [Nodename]) { @@ -224,6 +242,8 @@ public enum SENTINEL { public struct ISMASTERDOWNBYADDR: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "SENTINEL IS-MASTER-DOWN-BY-ADDR" } + public var ip: Ip public var port: Int public var currentEpoch: Int @@ -246,6 +266,8 @@ public enum SENTINEL { public struct ISPRIMARYDOWNBYADDR: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "SENTINEL IS-PRIMARY-DOWN-BY-ADDR" } + public var ip: Ip public var port: Int public var currentEpoch: Int @@ -268,6 +290,8 @@ public enum SENTINEL { public struct MASTER: ValkeyCommand { public typealias Response = RESPToken.Map + @inlinable public static var name: String { "SENTINEL MASTER" } + public var primaryName: PrimaryName @inlinable public init(primaryName: PrimaryName) { @@ -284,6 +308,8 @@ public enum SENTINEL { public struct MASTERS: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "SENTINEL MASTERS" } + @inlinable public init() { } @@ -295,6 +321,8 @@ public enum SENTINEL { /// Starts monitoring. @_documentation(visibility: internal) public struct MONITOR: ValkeyCommand { + @inlinable public static var name: String { "SENTINEL MONITOR" } + public var name: Name public var ip: Ip public var port: Int @@ -317,6 +345,8 @@ public enum SENTINEL { public struct MYID: ValkeyCommand { public typealias Response = ByteBuffer + @inlinable public static var name: String { "SENTINEL MYID" } + @inlinable public init() { } @@ -330,6 +360,8 @@ public enum SENTINEL { public struct PENDINGSCRIPTS: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "SENTINEL PENDING-SCRIPTS" } + @inlinable public init() { } @@ -343,6 +375,8 @@ public enum SENTINEL { public struct PRIMARIES: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "SENTINEL PRIMARIES" } + @inlinable public init() { } @@ -356,6 +390,8 @@ public enum SENTINEL { public struct PRIMARY: ValkeyCommand { public typealias Response = RESPToken.Map + @inlinable public static var name: String { "SENTINEL PRIMARY" } + public var primaryName: PrimaryName @inlinable public init(primaryName: PrimaryName) { @@ -370,6 +406,8 @@ public enum SENTINEL { /// Stops monitoring. @_documentation(visibility: internal) public struct REMOVE: ValkeyCommand { + @inlinable public static var name: String { "SENTINEL REMOVE" } + public var primaryName: PrimaryName @inlinable public init(primaryName: PrimaryName) { @@ -386,6 +424,8 @@ public enum SENTINEL { public struct REPLICAS: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "SENTINEL REPLICAS" } + public var primaryName: PrimaryName @inlinable public init(primaryName: PrimaryName) { @@ -402,6 +442,8 @@ public enum SENTINEL { public struct RESET: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "SENTINEL RESET" } + public var pattern: String @inlinable public init(pattern: String) { @@ -418,6 +460,8 @@ public enum SENTINEL { public struct SENTINELS: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "SENTINEL SENTINELS" } + public var primaryName: PrimaryName @inlinable public init(primaryName: PrimaryName) { @@ -452,6 +496,8 @@ public enum SENTINEL { RESPBulkString(value).encode(into: &commandEncoder) } } + @inlinable public static var name: String { "SENTINEL SET" } + public var primaryName: PrimaryName public var data: [Data] @@ -487,6 +533,8 @@ public enum SENTINEL { } public typealias Response = RESPToken.Array? + @inlinable public static var name: String { "SENTINEL SIMULATE-FAILURE" } + public var modes: [Mode] @inlinable public init(modes: [Mode] = []) { @@ -503,6 +551,8 @@ public enum SENTINEL { public struct SLAVES: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "SENTINEL SLAVES" } + public var primaryName: PrimaryName @inlinable public init(primaryName: PrimaryName) { diff --git a/Sources/Valkey/Commands/ServerCommands.swift b/Sources/Valkey/Commands/ServerCommands.swift index ceea81c1..30d463ee 100644 --- a/Sources/Valkey/Commands/ServerCommands.swift +++ b/Sources/Valkey/Commands/ServerCommands.swift @@ -30,6 +30,8 @@ public enum ACL { public struct CAT: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "ACL CAT" } + public var category: String? @inlinable public init(category: String? = nil) { @@ -46,6 +48,8 @@ public enum ACL { public struct DELUSER: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "ACL DELUSER" } + public var usernames: [Username] @inlinable public init(usernames: [Username]) { @@ -62,6 +66,8 @@ public enum ACL { public struct DRYRUN: ValkeyCommand { public typealias Response = ByteBuffer? + @inlinable public static var name: String { "ACL DRYRUN" } + public var username: Username public var command: Command public var args: [String] @@ -82,6 +88,8 @@ public enum ACL { public struct GENPASS: ValkeyCommand { public typealias Response = ByteBuffer + @inlinable public static var name: String { "ACL GENPASS" } + public var bits: Int? @inlinable public init(bits: Int? = nil) { @@ -98,6 +106,8 @@ public enum ACL { public struct GETUSER: ValkeyCommand { public typealias Response = RESPToken.Map? + @inlinable public static var name: String { "ACL GETUSER" } + public var username: Username @inlinable public init(username: Username) { @@ -114,6 +124,8 @@ public enum ACL { public struct HELP: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "ACL HELP" } + @inlinable public init() { } @@ -127,6 +139,8 @@ public enum ACL { public struct LIST: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "ACL LIST" } + @inlinable public init() { } @@ -138,6 +152,8 @@ public enum ACL { /// Reloads the rules from the configured ACL file. @_documentation(visibility: internal) public struct LOAD: ValkeyCommand { + @inlinable public static var name: String { "ACL LOAD" } + @inlinable public init() { } @@ -171,6 +187,8 @@ public enum ACL { } public typealias Response = RESPToken.Array? + @inlinable public static var name: String { "ACL LOG" } + public var operation: Operation? @inlinable public init(operation: Operation? = nil) { @@ -185,6 +203,8 @@ public enum ACL { /// Saves the effective ACL rules in the configured ACL file. @_documentation(visibility: internal) public struct SAVE: ValkeyCommand { + @inlinable public static var name: String { "ACL SAVE" } + @inlinable public init() { } @@ -196,6 +216,8 @@ public enum ACL { /// Creates and modifies an ACL user and its rules. @_documentation(visibility: internal) public struct SETUSER: ValkeyCommand { + @inlinable public static var name: String { "ACL SETUSER" } + public var username: Username public var rules: [String] @@ -214,6 +236,8 @@ public enum ACL { public struct USERS: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "ACL USERS" } + @inlinable public init() { } @@ -227,6 +251,8 @@ public enum ACL { public struct WHOAMI: ValkeyCommand { public typealias Response = ByteBuffer + @inlinable public static var name: String { "ACL WHOAMI" } + @inlinable public init() { } @@ -243,6 +269,8 @@ extension COMMAND { public struct COUNT: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "COMMAND COUNT" } + @inlinable public init() { } @@ -256,6 +284,8 @@ extension COMMAND { public struct DOCS: ValkeyCommand { public typealias Response = RESPToken.Map + @inlinable public static var name: String { "COMMAND DOCS" } + public var commandNames: [String] @inlinable public init(commandNames: [String] = []) { @@ -272,6 +302,8 @@ extension COMMAND { public struct GETKEYS: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "COMMAND GETKEYS" } + public var command: Command public var args: [String] @@ -290,6 +322,8 @@ extension COMMAND { public struct GETKEYSANDFLAGS: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "COMMAND GETKEYSANDFLAGS" } + public var command: Command public var args: [String] @@ -308,6 +342,8 @@ extension COMMAND { public struct HELP: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "COMMAND HELP" } + @inlinable public init() { } @@ -321,6 +357,8 @@ extension COMMAND { public struct INFO: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "COMMAND INFO" } + public var commandNames: [String] @inlinable public init(commandNames: [String] = []) { @@ -360,6 +398,8 @@ extension COMMAND { } public typealias Response = RESPToken.Array + @inlinable public static var name: String { "COMMAND LIST" } + public var filterby: Filterby? @inlinable public init(filterby: Filterby? = nil) { @@ -404,6 +444,8 @@ public enum COMMANDLOG { } public typealias Response = RESPToken.Array + @inlinable public static var name: String { "COMMANDLOG GET" } + public var count: Int public var type: _Type @@ -422,6 +464,8 @@ public enum COMMANDLOG { public struct HELP: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "COMMANDLOG HELP" } + @inlinable public init() { } @@ -458,6 +502,8 @@ public enum COMMANDLOG { } public typealias Response = Int + @inlinable public static var name: String { "COMMANDLOG LEN" } + public var type: _Type @inlinable public init(type: _Type) { @@ -495,6 +541,8 @@ public enum COMMANDLOG { } } } + @inlinable public static var name: String { "COMMANDLOG RESET" } + public var type: _Type @inlinable public init(type: _Type) { @@ -516,6 +564,8 @@ public enum CONFIG { public struct GET: ValkeyCommand { public typealias Response = RESPToken.Map + @inlinable public static var name: String { "CONFIG GET" } + public var parameters: [Parameter] @inlinable public init(parameters: [Parameter]) { @@ -532,6 +582,8 @@ public enum CONFIG { public struct HELP: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "CONFIG HELP" } + @inlinable public init() { } @@ -543,6 +595,8 @@ public enum CONFIG { /// Resets the server's statistics. @_documentation(visibility: internal) public struct RESETSTAT: ValkeyCommand { + @inlinable public static var name: String { "CONFIG RESETSTAT" } + @inlinable public init() { } @@ -554,6 +608,8 @@ public enum CONFIG { /// Persists the effective configuration to file. @_documentation(visibility: internal) public struct REWRITE: ValkeyCommand { + @inlinable public static var name: String { "CONFIG REWRITE" } + @inlinable public init() { } @@ -585,6 +641,8 @@ public enum CONFIG { RESPBulkString(value).encode(into: &commandEncoder) } } + @inlinable public static var name: String { "CONFIG SET" } + public var data: [Data] @inlinable public init(data: [Data]) { @@ -606,6 +664,8 @@ public enum LATENCY { public struct DOCTOR: ValkeyCommand { public typealias Response = ByteBuffer + @inlinable public static var name: String { "LATENCY DOCTOR" } + @inlinable public init() { } @@ -619,6 +679,8 @@ public enum LATENCY { public struct GRAPH: ValkeyCommand { public typealias Response = ByteBuffer + @inlinable public static var name: String { "LATENCY GRAPH" } + public var event: Event @inlinable public init(event: Event) { @@ -635,6 +697,8 @@ public enum LATENCY { public struct HELP: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "LATENCY HELP" } + @inlinable public init() { } @@ -648,6 +712,8 @@ public enum LATENCY { public struct HISTOGRAM: ValkeyCommand { public typealias Response = RESPToken.Map + @inlinable public static var name: String { "LATENCY HISTOGRAM" } + public var commands: [String] @inlinable public init(commands: [String] = []) { @@ -664,6 +730,8 @@ public enum LATENCY { public struct HISTORY: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "LATENCY HISTORY" } + public var event: Event @inlinable public init(event: Event) { @@ -680,6 +748,8 @@ public enum LATENCY { public struct LATEST: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "LATENCY LATEST" } + @inlinable public init() { } @@ -693,6 +763,8 @@ public enum LATENCY { public struct RESET: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "LATENCY RESET" } + public var events: [String] @inlinable public init(events: [String] = []) { @@ -714,6 +786,8 @@ public enum MEMORY { public struct DOCTOR: ValkeyCommand { public typealias Response = ByteBuffer + @inlinable public static var name: String { "MEMORY DOCTOR" } + @inlinable public init() { } @@ -727,6 +801,8 @@ public enum MEMORY { public struct HELP: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "MEMORY HELP" } + @inlinable public init() { } @@ -740,6 +816,8 @@ public enum MEMORY { public struct MALLOCSTATS: ValkeyCommand { public typealias Response = ByteBuffer + @inlinable public static var name: String { "MEMORY MALLOC-STATS" } + @inlinable public init() { } @@ -751,6 +829,8 @@ public enum MEMORY { /// Asks the allocator to release memory. @_documentation(visibility: internal) public struct PURGE: ValkeyCommand { + @inlinable public static var name: String { "MEMORY PURGE" } + @inlinable public init() { } @@ -764,6 +844,8 @@ public enum MEMORY { public struct STATS: ValkeyCommand { public typealias Response = RESPToken.Map + @inlinable public static var name: String { "MEMORY STATS" } + @inlinable public init() { } @@ -777,6 +859,8 @@ public enum MEMORY { public struct USAGE: ValkeyCommand { public typealias Response = Int? + @inlinable public static var name: String { "MEMORY USAGE" } + public var key: ValkeyKey public var count: Int? @@ -804,6 +888,8 @@ public enum MODULE { public struct HELP: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "MODULE HELP" } + @inlinable public init() { } @@ -817,6 +903,8 @@ public enum MODULE { public struct LIST: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "MODULE LIST" } + @inlinable public init() { } @@ -828,6 +916,8 @@ public enum MODULE { /// Loads a module. @_documentation(visibility: internal) public struct LOAD: ValkeyCommand { + @inlinable public static var name: String { "MODULE LOAD" } + public var path: Path public var args: [String] @@ -864,6 +954,8 @@ public enum MODULE { value.encode(into: &commandEncoder) } } + @inlinable public static var name: String { "MODULE LOADEX" } + public var path: Path public var configs: [Configs] public var args: [String] @@ -882,6 +974,8 @@ public enum MODULE { /// Unloads a module. @_documentation(visibility: internal) public struct UNLOAD: ValkeyCommand { + @inlinable public static var name: String { "MODULE UNLOAD" } + public var name: Name @inlinable public init(name: Name) { @@ -903,6 +997,8 @@ public enum SLOWLOG { public struct GET: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "SLOWLOG GET" } + public var count: Int? @inlinable public init(count: Int? = nil) { @@ -919,6 +1015,8 @@ public enum SLOWLOG { public struct HELP: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "SLOWLOG HELP" } + @inlinable public init() { } @@ -932,6 +1030,8 @@ public enum SLOWLOG { public struct LEN: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "SLOWLOG LEN" } + @inlinable public init() { } @@ -943,6 +1043,8 @@ public enum SLOWLOG { /// Clears all entries from the slow log. @_documentation(visibility: internal) public struct RESET: ValkeyCommand { + @inlinable public static var name: String { "SLOWLOG RESET" } + @inlinable public init() { } @@ -958,6 +1060,8 @@ public enum SLOWLOG { public struct BGREWRITEAOF: ValkeyCommand { public typealias Response = ByteBuffer + @inlinable public static var name: String { "BGREWRITEAOF" } + @inlinable public init() { } @@ -986,6 +1090,8 @@ public struct BGSAVE: ValkeyCommand { } public typealias Response = String + @inlinable public static var name: String { "BGSAVE" } + public var operation: Operation? @inlinable public init(operation: Operation? = nil) { @@ -1000,6 +1106,8 @@ public struct BGSAVE: ValkeyCommand { /// Returns detailed information about all commands. @_documentation(visibility: internal) public struct COMMAND: ValkeyCommand { + @inlinable public static var name: String { "COMMAND" } + @inlinable public init() { } @@ -1013,6 +1121,8 @@ public struct COMMAND: ValkeyCommand { public struct DBSIZE: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "DBSIZE" } + @inlinable public init() { } @@ -1049,6 +1159,8 @@ public struct FAILOVER: ValkeyCommand { RESPPureToken("FORCE", force).encode(into: &commandEncoder) } } + @inlinable public static var name: String { "FAILOVER" } + public var target: Target? public var abort: Bool public var milliseconds: Int? @@ -1082,6 +1194,8 @@ public struct FLUSHALL: ValkeyCommand { } } } + @inlinable public static var name: String { "FLUSHALL" } + public var flushType: FlushType? @inlinable public init(flushType: FlushType? = nil) { @@ -1111,6 +1225,8 @@ public struct FLUSHDB: ValkeyCommand { } } } + @inlinable public static var name: String { "FLUSHDB" } + public var flushType: FlushType? @inlinable public init(flushType: FlushType? = nil) { @@ -1127,6 +1243,8 @@ public struct FLUSHDB: ValkeyCommand { public struct INFO: ValkeyCommand { public typealias Response = ByteBuffer + @inlinable public static var name: String { "INFO" } + public var sections: [String] @inlinable public init(sections: [String] = []) { @@ -1143,6 +1261,8 @@ public struct INFO: ValkeyCommand { public struct LASTSAVE: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "LASTSAVE" } + @inlinable public init() { } @@ -1156,6 +1276,8 @@ public struct LASTSAVE: ValkeyCommand { public struct LOLWUT: ValkeyCommand { public typealias Response = ByteBuffer + @inlinable public static var name: String { "LOLWUT" } + public var version: Int? @inlinable public init(version: Int? = nil) { @@ -1172,6 +1294,8 @@ public struct LOLWUT: ValkeyCommand { /// Listens for all requests received by the server in real-time. @_documentation(visibility: internal) public struct MONITOR: ValkeyCommand { + @inlinable public static var name: String { "MONITOR" } + @inlinable public init() { } @@ -1183,6 +1307,8 @@ public struct MONITOR: ValkeyCommand { /// An internal command used in replication. @_documentation(visibility: internal) public struct PSYNC: ValkeyCommand { + @inlinable public static var name: String { "PSYNC" } + public var replicationid: Replicationid public var offset: Int @@ -1257,6 +1383,8 @@ public struct REPLICAOF: ValkeyCommand { } public typealias Response = ByteBuffer + @inlinable public static var name: String { "REPLICAOF" } + public var args: Args @inlinable public init(args: Args) { @@ -1271,6 +1399,8 @@ public struct REPLICAOF: ValkeyCommand { /// Returns the replication role. @_documentation(visibility: internal) public struct ROLE: ValkeyCommand { + @inlinable public static var name: String { "ROLE" } + @inlinable public init() { } @@ -1282,6 +1412,8 @@ public struct ROLE: ValkeyCommand { /// Synchronously saves the database(s) to disk. @_documentation(visibility: internal) public struct SAVE: ValkeyCommand { + @inlinable public static var name: String { "SAVE" } + @inlinable public init() { } @@ -1351,6 +1483,8 @@ public struct SHUTDOWN: ValkeyCommand { } } } + @inlinable public static var name: String { "SHUTDOWN" } + public var abortSelector: AbortSelector? @inlinable public init(abortSelector: AbortSelector? = nil) { @@ -1423,6 +1557,8 @@ public struct SLAVEOF: ValkeyCommand { } public typealias Response = ByteBuffer + @inlinable public static var name: String { "SLAVEOF" } + public var args: Args @inlinable public init(args: Args) { @@ -1437,6 +1573,8 @@ public struct SLAVEOF: ValkeyCommand { /// Swaps two databases. @_documentation(visibility: internal) public struct SWAPDB: ValkeyCommand { + @inlinable public static var name: String { "SWAPDB" } + public var index1: Int public var index2: Int @@ -1453,6 +1591,8 @@ public struct SWAPDB: ValkeyCommand { /// An internal command used in replication. @_documentation(visibility: internal) public struct SYNC: ValkeyCommand { + @inlinable public static var name: String { "SYNC" } + @inlinable public init() { } @@ -1466,6 +1606,8 @@ public struct SYNC: ValkeyCommand { public struct TIME: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "TIME" } + @inlinable public init() { } diff --git a/Sources/Valkey/Commands/SetCommands.swift b/Sources/Valkey/Commands/SetCommands.swift index a2a72169..691aa1cb 100644 --- a/Sources/Valkey/Commands/SetCommands.swift +++ b/Sources/Valkey/Commands/SetCommands.swift @@ -27,6 +27,8 @@ import Foundation public struct SADD: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "SADD" } + public var key: ValkeyKey public var members: [Member] @@ -47,6 +49,8 @@ public struct SADD: ValkeyCommand { public struct SCARD: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "SCARD" } + public var key: ValkeyKey @inlinable public init(_ key: ValkeyKey) { @@ -67,6 +71,8 @@ public struct SCARD: ValkeyCommand { public struct SDIFF: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "SDIFF" } + public var keys: [ValkeyKey] @inlinable public init(keys: [ValkeyKey]) { @@ -87,6 +93,8 @@ public struct SDIFF: ValkeyCommand { public struct SDIFFSTORE: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "SDIFFSTORE" } + public var destination: ValkeyKey public var keys: [ValkeyKey] @@ -107,6 +115,8 @@ public struct SDIFFSTORE: ValkeyCommand { public struct SINTER: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "SINTER" } + public var keys: [ValkeyKey] @inlinable public init(keys: [ValkeyKey]) { @@ -127,6 +137,8 @@ public struct SINTER: ValkeyCommand { public struct SINTERCARD: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "SINTERCARD" } + public var keys: [ValkeyKey] public var limit: Int? @@ -149,6 +161,8 @@ public struct SINTERCARD: ValkeyCommand { public struct SINTERSTORE: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "SINTERSTORE" } + public var destination: ValkeyKey public var keys: [ValkeyKey] @@ -169,6 +183,8 @@ public struct SINTERSTORE: ValkeyCommand { public struct SISMEMBER: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "SISMEMBER" } + public var key: ValkeyKey public var member: Member @@ -191,6 +207,8 @@ public struct SISMEMBER: ValkeyCommand { public struct SMEMBERS: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "SMEMBERS" } + public var key: ValkeyKey @inlinable public init(_ key: ValkeyKey) { @@ -211,6 +229,8 @@ public struct SMEMBERS: ValkeyCommand { public struct SMISMEMBER: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "SMISMEMBER" } + public var key: ValkeyKey public var members: [Member] @@ -233,6 +253,8 @@ public struct SMISMEMBER: ValkeyCommand { public struct SMOVE: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "SMOVE" } + public var source: ValkeyKey public var destination: ValkeyKey public var member: Member @@ -253,6 +275,8 @@ public struct SMOVE: ValkeyCommand { /// Returns one or more random members from a set after removing them. Deletes the set if the last member was popped. @_documentation(visibility: internal) public struct SPOP: ValkeyCommand { + @inlinable public static var name: String { "SPOP" } + public var key: ValkeyKey public var count: Int? @@ -273,6 +297,8 @@ public struct SPOP: ValkeyCommand { public struct SRANDMEMBER: ValkeyCommand { public typealias Response = RESPToken? + @inlinable public static var name: String { "SRANDMEMBER" } + public var key: ValkeyKey public var count: Int? @@ -295,6 +321,8 @@ public struct SRANDMEMBER: ValkeyCommand { public struct SREM: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "SREM" } + public var key: ValkeyKey public var members: [Member] @@ -313,6 +341,8 @@ public struct SREM: ValkeyCommand { /// Iterates over members of a set. @_documentation(visibility: internal) public struct SSCAN: ValkeyCommand { + @inlinable public static var name: String { "SSCAN" } + public var key: ValkeyKey public var cursor: Int public var pattern: String? @@ -339,6 +369,8 @@ public struct SSCAN: ValkeyCommand { public struct SUNION: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "SUNION" } + public var keys: [ValkeyKey] @inlinable public init(keys: [ValkeyKey]) { @@ -359,6 +391,8 @@ public struct SUNION: ValkeyCommand { public struct SUNIONSTORE: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "SUNIONSTORE" } + public var destination: ValkeyKey public var keys: [ValkeyKey] diff --git a/Sources/Valkey/Commands/SortedSetCommands.swift b/Sources/Valkey/Commands/SortedSetCommands.swift index 83555234..57bc704f 100644 --- a/Sources/Valkey/Commands/SortedSetCommands.swift +++ b/Sources/Valkey/Commands/SortedSetCommands.swift @@ -40,6 +40,8 @@ public struct BZMPOP: ValkeyCommand { } } } + @inlinable public static var name: String { "BZMPOP" } + public var timeout: Double public var keys: [ValkeyKey] public var `where`: Where @@ -64,6 +66,8 @@ public struct BZMPOP: ValkeyCommand { /// Removes and returns the member with the highest score from one or more sorted sets. Blocks until a member available otherwise. Deletes the sorted set if the last element was popped. @_documentation(visibility: internal) public struct BZPOPMAX: ValkeyCommand { + @inlinable public static var name: String { "BZPOPMAX" } + public var keys: [ValkeyKey] public var timeout: Double @@ -84,6 +88,8 @@ public struct BZPOPMAX: ValkeyCommand { /// Removes and returns the member with the lowest score from one or more sorted sets. Blocks until a member is available otherwise. Deletes the sorted set if the last element was popped. @_documentation(visibility: internal) public struct BZPOPMIN: ValkeyCommand { + @inlinable public static var name: String { "BZPOPMIN" } + public var keys: [ValkeyKey] public var timeout: Double @@ -156,6 +162,8 @@ public struct ZADD: ValkeyCommand { } public typealias Response = RESPToken? + @inlinable public static var name: String { "ZADD" } + public var key: ValkeyKey public var condition: Condition? public var comparison: Comparison? @@ -191,6 +199,8 @@ public struct ZADD: ValkeyCommand { public struct ZCARD: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "ZCARD" } + public var key: ValkeyKey @inlinable public init(_ key: ValkeyKey) { @@ -211,6 +221,8 @@ public struct ZCARD: ValkeyCommand { public struct ZCOUNT: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "ZCOUNT" } + public var key: ValkeyKey public var min: Double public var max: Double @@ -235,6 +247,8 @@ public struct ZCOUNT: ValkeyCommand { public struct ZDIFF: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "ZDIFF" } + public var keys: [ValkeyKey] public var withscores: Bool @@ -257,6 +271,8 @@ public struct ZDIFF: ValkeyCommand { public struct ZDIFFSTORE: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "ZDIFFSTORE" } + public var destination: ValkeyKey public var keys: [ValkeyKey] @@ -277,6 +293,8 @@ public struct ZDIFFSTORE: ValkeyCommand { public struct ZINCRBY: ValkeyCommand { public typealias Response = Double + @inlinable public static var name: String { "ZINCRBY" } + public var key: ValkeyKey public var increment: Int public var member: Member @@ -316,6 +334,8 @@ public struct ZINTER: ValkeyCommand { } public typealias Response = RESPToken.Array + @inlinable public static var name: String { "ZINTER" } + public var keys: [ValkeyKey] public var weights: [Int] public var aggregate: Aggregate? @@ -348,6 +368,8 @@ public struct ZINTER: ValkeyCommand { public struct ZINTERCARD: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "ZINTERCARD" } + public var keys: [ValkeyKey] public var limit: Int? @@ -387,6 +409,8 @@ public struct ZINTERSTORE: ValkeyCommand { } public typealias Response = Int + @inlinable public static var name: String { "ZINTERSTORE" } + public var destination: ValkeyKey public var keys: [ValkeyKey] public var weights: [Int] @@ -417,6 +441,8 @@ public struct ZINTERSTORE: ValkeyCommand { public struct ZLEXCOUNT: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "ZLEXCOUNT" } + public var key: ValkeyKey public var min: Min public var max: Max @@ -454,6 +480,8 @@ public struct ZMPOP: ValkeyCommand { } } } + @inlinable public static var name: String { "ZMPOP" } + public var keys: [ValkeyKey] public var `where`: Where public var count: Int? @@ -476,6 +504,8 @@ public struct ZMPOP: ValkeyCommand { public struct ZMSCORE: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "ZMSCORE" } + public var key: ValkeyKey public var members: [Member] @@ -496,6 +526,8 @@ public struct ZMSCORE: ValkeyCommand { /// Returns the highest-scoring members from a sorted set after removing them. Deletes the sorted set if the last member was popped. @_documentation(visibility: internal) public struct ZPOPMAX: ValkeyCommand { + @inlinable public static var name: String { "ZPOPMAX" } + public var key: ValkeyKey public var count: Int? @@ -514,6 +546,8 @@ public struct ZPOPMAX: ValkeyCommand { /// Returns the lowest-scoring members from a sorted set after removing them. Deletes the sorted set if the last member was popped. @_documentation(visibility: internal) public struct ZPOPMIN: ValkeyCommand { + @inlinable public static var name: String { "ZPOPMIN" } + public var key: ValkeyKey public var count: Int? @@ -554,6 +588,8 @@ public struct ZRANDMEMBER: ValkeyCommand { } public typealias Response = RESPToken? + @inlinable public static var name: String { "ZRANDMEMBER" } + public var key: ValkeyKey public var options: Options? @@ -611,6 +647,8 @@ public struct ZRANGE: V } public typealias Response = RESPToken.Array + @inlinable public static var name: String { "ZRANGE" } + public var key: ValkeyKey public var start: Start public var stop: Stop @@ -680,6 +718,8 @@ public struct ZRANGEBYLEX: } public typealias Response = RESPToken.Array + @inlinable public static var name: String { "ZRANGEBYLEX" } + public var key: ValkeyKey public var min: Min public var max: Max @@ -726,6 +766,8 @@ public struct ZRANGEBYSCORE: ValkeyCommand { } public typealias Response = RESPToken.Array + @inlinable public static var name: String { "ZRANGEBYSCORE" } + public var key: ValkeyKey public var min: Double public var max: Double @@ -789,6 +831,8 @@ public struct ZRANGESTORE: } public typealias Response = Int + @inlinable public static var name: String { "ZRANGESTORE" } + public var dst: ValkeyKey public var src: ValkeyKey public var min: Min @@ -828,6 +872,8 @@ public struct ZRANGESTORE: public struct ZRANK: ValkeyCommand { public typealias Response = RESPToken? + @inlinable public static var name: String { "ZRANK" } + public var key: ValkeyKey public var member: Member public var withscore: Bool @@ -852,6 +898,8 @@ public struct ZRANK: ValkeyCommand { public struct ZREM: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "ZREM" } + public var key: ValkeyKey public var members: [Member] @@ -872,6 +920,8 @@ public struct ZREM: ValkeyCommand { public struct ZREMRANGEBYLEX: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "ZREMRANGEBYLEX" } + public var key: ValkeyKey public var min: Min public var max: Max @@ -894,6 +944,8 @@ public struct ZREMRANGEBYLEX: ValkeyCommand { public typealias Response = RESPToken? + @inlinable public static var name: String { "ZREVRANK" } + public var key: ValkeyKey public var member: Member public var withscore: Bool @@ -1082,6 +1144,8 @@ public struct ZREVRANK: ValkeyCommand { public struct ZSCAN: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "ZSCAN" } + public var key: ValkeyKey public var cursor: Int public var pattern: String? @@ -1117,6 +1181,8 @@ public struct ZSCAN: ValkeyCommand { public struct ZSCORE: ValkeyCommand { public typealias Response = Double? + @inlinable public static var name: String { "ZSCORE" } + public var key: ValkeyKey public var member: Member @@ -1156,6 +1222,8 @@ public struct ZUNION: ValkeyCommand { } public typealias Response = RESPToken.Array + @inlinable public static var name: String { "ZUNION" } + public var keys: [ValkeyKey] public var weights: [Int] public var aggregate: Aggregate? @@ -1205,6 +1273,8 @@ public struct ZUNIONSTORE: ValkeyCommand { } public typealias Response = Int + @inlinable public static var name: String { "ZUNIONSTORE" } + public var destination: ValkeyKey public var keys: [ValkeyKey] public var weights: [Int] diff --git a/Sources/Valkey/Commands/StreamCommands.swift b/Sources/Valkey/Commands/StreamCommands.swift index 6e7e41cb..00e0ecf4 100644 --- a/Sources/Valkey/Commands/StreamCommands.swift +++ b/Sources/Valkey/Commands/StreamCommands.swift @@ -48,6 +48,8 @@ public enum XGROUP { } } } + @inlinable public static var name: String { "XGROUP CREATE" } + public var key: ValkeyKey public var group: Group public var idSelector: IdSelector @@ -82,6 +84,8 @@ public enum XGROUP { public struct CREATECONSUMER: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "XGROUP CREATECONSUMER" } + public var key: ValkeyKey public var group: Group public var consumer: Consumer @@ -104,6 +108,8 @@ public enum XGROUP { public struct DELCONSUMER: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "XGROUP DELCONSUMER" } + public var key: ValkeyKey public var group: Group public var consumer: Consumer @@ -126,6 +132,8 @@ public enum XGROUP { public struct DESTROY: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "XGROUP DESTROY" } + public var key: ValkeyKey public var group: Group @@ -146,6 +154,8 @@ public enum XGROUP { public struct HELP: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "XGROUP HELP" } + @inlinable public init() { } @@ -177,6 +187,8 @@ public enum XGROUP { } } } + @inlinable public static var name: String { "XGROUP SETID" } + public var key: ValkeyKey public var group: Group public var idSelector: IdSelector @@ -206,6 +218,8 @@ public enum XINFO { public struct CONSUMERS: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "XINFO CONSUMERS" } + public var key: ValkeyKey public var group: Group @@ -228,6 +242,8 @@ public enum XINFO { public struct GROUPS: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "XINFO GROUPS" } + public var key: ValkeyKey @inlinable public init(_ key: ValkeyKey) { @@ -248,6 +264,8 @@ public enum XINFO { public struct HELP: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "XINFO HELP" } + @inlinable public init() { } @@ -279,6 +297,8 @@ public enum XINFO { } public typealias Response = RESPToken.Map + @inlinable public static var name: String { "XINFO STREAM" } + public var key: ValkeyKey public var fullBlock: FullBlock? @@ -303,6 +323,8 @@ public enum XINFO { public struct XACK: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "XACK" } + public var key: ValkeyKey public var group: Group public var ids: [Id] @@ -421,6 +443,8 @@ public struct XADD: Va } public typealias Response = ByteBuffer? + @inlinable public static var name: String { "XADD" } + public var key: ValkeyKey public var nomkstream: Bool public var trim: Trim? @@ -447,6 +471,8 @@ public struct XADD: Va public struct XAUTOCLAIM: ValkeyCommand { + @inlinable public static var name: String { "XAUTOCLAIM" } + public var key: ValkeyKey public var group: Group public var consumer: Consumer @@ -494,6 +520,8 @@ public struct XAUTOCLAIM: ValkeyCommand { + @inlinable public static var name: String { "XCLAIM" } + public var key: ValkeyKey public var group: Group public var consumer: Consumer @@ -557,6 +585,8 @@ public struct XCLAIM: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "XDEL" } + public var key: ValkeyKey public var ids: [Id] @@ -577,6 +607,8 @@ public struct XDEL: ValkeyCommand { public struct XLEN: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "XLEN" } + public var key: ValkeyKey @inlinable public init(_ key: ValkeyKey) { @@ -624,6 +656,8 @@ public struct XPENDING: ValkeyCommand { consumer.encode(into: &commandEncoder) } } + @inlinable public static var name: String { "XPENDING" } + public var key: ValkeyKey public var group: Group public var filters: Filters? @@ -646,6 +680,8 @@ public struct XPENDING: ValkeyCommand { /// Returns the messages from a stream within a range of IDs. @_documentation(visibility: internal) public struct XRANGE: ValkeyCommand { + @inlinable public static var name: String { "XRANGE" } + public var key: ValkeyKey public var start: Start public var end: End @@ -690,6 +726,8 @@ public struct XREAD: ValkeyCommand { ids.map { RESPBulkString($0) }.encode(into: &commandEncoder) } } + @inlinable public static var name: String { "XREAD" } + public var count: Int? public var milliseconds: Int? public var streams: Streams @@ -754,6 +792,8 @@ public struct XREADGROUP: ValkeyCommand { + @inlinable public static var name: String { "XREVRANGE" } + public var key: ValkeyKey public var end: End public var start: Start @@ -811,6 +853,8 @@ public struct XREVRANGE: /// An internal command for replicating stream values. @_documentation(visibility: internal) public struct XSETID: ValkeyCommand { + @inlinable public static var name: String { "XSETID" } + public var key: ValkeyKey public var lastId: LastId public var entriesAdded: Int? @@ -897,6 +941,8 @@ public struct XTRIM: ValkeyCommand { } public typealias Response = Int + @inlinable public static var name: String { "XTRIM" } + public var key: ValkeyKey public var trim: Trim diff --git a/Sources/Valkey/Commands/StringCommands.swift b/Sources/Valkey/Commands/StringCommands.swift index e1311852..5523380b 100644 --- a/Sources/Valkey/Commands/StringCommands.swift +++ b/Sources/Valkey/Commands/StringCommands.swift @@ -27,6 +27,8 @@ import Foundation public struct APPEND: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "APPEND" } + public var key: ValkeyKey public var value: Value @@ -47,6 +49,8 @@ public struct APPEND: ValkeyCommand { public struct DECR: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "DECR" } + public var key: ValkeyKey @inlinable public init(_ key: ValkeyKey) { @@ -65,6 +69,8 @@ public struct DECR: ValkeyCommand { public struct DECRBY: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "DECRBY" } + public var key: ValkeyKey public var decrement: Int @@ -85,6 +91,8 @@ public struct DECRBY: ValkeyCommand { public struct GET: ValkeyCommand { public typealias Response = ByteBuffer? + @inlinable public static var name: String { "GET" } + public var key: ValkeyKey @inlinable public init(_ key: ValkeyKey) { @@ -105,6 +113,8 @@ public struct GET: ValkeyCommand { public struct GETDEL: ValkeyCommand { public typealias Response = ByteBuffer? + @inlinable public static var name: String { "GETDEL" } + public var key: ValkeyKey @inlinable public init(_ key: ValkeyKey) { @@ -155,6 +165,8 @@ public struct GETEX: ValkeyCommand { } public typealias Response = ByteBuffer? + @inlinable public static var name: String { "GETEX" } + public var key: ValkeyKey public var expiration: Expiration? @@ -175,6 +187,8 @@ public struct GETEX: ValkeyCommand { public struct GETRANGE: ValkeyCommand { public typealias Response = ByteBuffer + @inlinable public static var name: String { "GETRANGE" } + public var key: ValkeyKey public var start: Int public var end: Int @@ -199,6 +213,8 @@ public struct GETRANGE: ValkeyCommand { public struct GETSET: ValkeyCommand { public typealias Response = ByteBuffer? + @inlinable public static var name: String { "GETSET" } + public var key: ValkeyKey public var value: Value @@ -219,6 +235,8 @@ public struct GETSET: ValkeyCommand { public struct INCR: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "INCR" } + public var key: ValkeyKey @inlinable public init(_ key: ValkeyKey) { @@ -237,6 +255,8 @@ public struct INCR: ValkeyCommand { public struct INCRBY: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "INCRBY" } + public var key: ValkeyKey public var increment: Int @@ -257,6 +277,8 @@ public struct INCRBY: ValkeyCommand { public struct INCRBYFLOAT: ValkeyCommand { public typealias Response = ByteBuffer + @inlinable public static var name: String { "INCRBYFLOAT" } + public var key: ValkeyKey public var increment: Double @@ -275,6 +297,8 @@ public struct INCRBYFLOAT: ValkeyCommand { /// Finds the longest common substring. @_documentation(visibility: internal) public struct LCS: ValkeyCommand { + @inlinable public static var name: String { "LCS" } + public var key1: ValkeyKey public var key2: ValkeyKey public var len: Bool @@ -320,6 +344,8 @@ public struct LCS: ValkeyCommand { public struct MGET: ValkeyCommand { public typealias Response = RESPToken.Array + @inlinable public static var name: String { "MGET" } + public var keys: [ValkeyKey] @inlinable public init(keys: [ValkeyKey]) { @@ -358,6 +384,8 @@ public struct MSET: ValkeyCommand { RESPBulkString(value).encode(into: &commandEncoder) } } + @inlinable public static var name: String { "MSET" } + public var data: [Data] @inlinable public init(data: [Data]) { @@ -396,6 +424,8 @@ public struct MSETNX: ValkeyCommand { } public typealias Response = Int + @inlinable public static var name: String { "MSETNX" } + public var data: [Data] @inlinable public init(data: [Data]) { @@ -412,6 +442,8 @@ public struct MSETNX: ValkeyCommand { /// Sets both string value and expiration time in milliseconds of a key. The key is created if it doesn't exist. @_documentation(visibility: internal) public struct PSETEX: ValkeyCommand { + @inlinable public static var name: String { "PSETEX" } + public var key: ValkeyKey public var milliseconds: Int public var value: Value @@ -489,6 +521,8 @@ public struct SET: ValkeyCommand { } public typealias Response = ByteBuffer? + @inlinable public static var name: String { "SET" } + public var key: ValkeyKey public var value: Value public var condition: Condition? @@ -513,6 +547,8 @@ public struct SET: ValkeyCommand { /// Sets the string value and expiration time of a key. Creates the key if it doesn't exist. @_documentation(visibility: internal) public struct SETEX: ValkeyCommand { + @inlinable public static var name: String { "SETEX" } + public var key: ValkeyKey public var seconds: Int public var value: Value @@ -535,6 +571,8 @@ public struct SETEX: ValkeyCommand { public struct SETNX: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "SETNX" } + public var key: ValkeyKey public var value: Value @@ -555,6 +593,8 @@ public struct SETNX: ValkeyCommand { public struct SETRANGE: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "SETRANGE" } + public var key: ValkeyKey public var offset: Int public var value: Value @@ -577,6 +617,8 @@ public struct SETRANGE: ValkeyCommand { public struct STRLEN: ValkeyCommand { public typealias Response = Int + @inlinable public static var name: String { "STRLEN" } + public var key: ValkeyKey @inlinable public init(_ key: ValkeyKey) { @@ -597,6 +639,8 @@ public struct STRLEN: ValkeyCommand { public struct SUBSTR: ValkeyCommand { public typealias Response = ByteBuffer + @inlinable public static var name: String { "SUBSTR" } + public var key: ValkeyKey public var start: Int public var end: Int diff --git a/Sources/Valkey/Commands/TransactionsCommands.swift b/Sources/Valkey/Commands/TransactionsCommands.swift index 2c5ace39..a9c19bdd 100644 --- a/Sources/Valkey/Commands/TransactionsCommands.swift +++ b/Sources/Valkey/Commands/TransactionsCommands.swift @@ -25,6 +25,8 @@ import Foundation /// Discards a transaction. @_documentation(visibility: internal) public struct DISCARD: ValkeyCommand { + @inlinable public static var name: String { "DISCARD" } + @inlinable public init() { } @@ -38,6 +40,8 @@ public struct DISCARD: ValkeyCommand { public struct EXEC: ValkeyCommand { public typealias Response = RESPToken.Array? + @inlinable public static var name: String { "EXEC" } + @inlinable public init() { } @@ -49,6 +53,8 @@ public struct EXEC: ValkeyCommand { /// Starts a transaction. @_documentation(visibility: internal) public struct MULTI: ValkeyCommand { + @inlinable public static var name: String { "MULTI" } + @inlinable public init() { } @@ -60,6 +66,8 @@ public struct MULTI: ValkeyCommand { /// Forgets about watched keys of a transaction. @_documentation(visibility: internal) public struct UNWATCH: ValkeyCommand { + @inlinable public static var name: String { "UNWATCH" } + @inlinable public init() { } @@ -71,6 +79,8 @@ public struct UNWATCH: ValkeyCommand { /// Monitors changes to keys to determine the execution of a transaction. @_documentation(visibility: internal) public struct WATCH: ValkeyCommand { + @inlinable public static var name: String { "WATCH" } + public var keys: [ValkeyKey] @inlinable public init(keys: [ValkeyKey]) { diff --git a/Sources/Valkey/ValkeyCommand.swift b/Sources/Valkey/ValkeyCommand.swift index fa54c383..b8600cd4 100644 --- a/Sources/Valkey/ValkeyCommand.swift +++ b/Sources/Valkey/ValkeyCommand.swift @@ -19,6 +19,9 @@ public protocol ValkeyCommand: Sendable, Hashable { associatedtype Response: RESPTokenDecodable & Sendable = RESPToken associatedtype Keys: Collection + /// The name of this command. + static var name: String { get } + /// Keys affected by command. This is used in cluster mode to determine which /// shard to connect to. var keysAffected: Keys { get } @@ -46,6 +49,9 @@ extension ValkeyCommand { /// Wrapper for Valkey command that returns the response as a `RESPToken` @usableFromInline struct ValkeyRawResponseCommand: ValkeyCommand { + @inlinable + static var name: String { Command.name } + @usableFromInline let command: Command diff --git a/Sources/ValkeyBloom/BloomCommands.swift b/Sources/ValkeyBloom/BloomCommands.swift index 03901a9c..e6d06f9c 100644 --- a/Sources/ValkeyBloom/BloomCommands.swift +++ b/Sources/ValkeyBloom/BloomCommands.swift @@ -28,6 +28,8 @@ public enum BF { /// Add a single item to a bloom filter. The bloom filter is created if it doesn't exist @_documentation(visibility: internal) public struct ADD: ValkeyCommand { + @inlinable public static var name: String { "BF.ADD" } + public var key: ValkeyKey public var value: Value @@ -46,6 +48,8 @@ public enum BF { /// Returns the cardinality of a bloom filter @_documentation(visibility: internal) public struct CARD: ValkeyCommand { + @inlinable public static var name: String { "BF.CARD" } + public var key: ValkeyKey @inlinable public init(_ key: ValkeyKey) { @@ -62,6 +66,8 @@ public enum BF { /// Determines if the bloom filter contains the specified item @_documentation(visibility: internal) public struct EXISTS: ValkeyCommand { + @inlinable public static var name: String { "BF.EXISTS" } + public var key: ValkeyKey public var value: Value @@ -105,6 +111,8 @@ public enum BF { } } } + @inlinable public static var name: String { "BF.INFO" } + public var key: ValkeyKey public var sortby: Sortby? @@ -123,6 +131,8 @@ public enum BF { /// Creates a bloom filter with 0 or more items or adds items to an existing bloom filter @_documentation(visibility: internal) public struct INSERT: ValkeyCommand { + @inlinable public static var name: String { "BF.INSERT" } + public var key: ValkeyKey public var capacity: Int? public var error: Double? @@ -180,6 +190,8 @@ public enum BF { /// Restores a bloom filter in a single operation. The command is only generated during AOF Rewrite of bloom filters @_documentation(visibility: internal) public struct LOAD: ValkeyCommand { + @inlinable public static var name: String { "BF.LOAD" } + public var key: ValkeyKey public var dump: Dump @@ -198,6 +210,8 @@ public enum BF { /// Adds one or more items to a bloom filter. The bloom filter is created if it doesn't exist @_documentation(visibility: internal) public struct MADD: ValkeyCommand { + @inlinable public static var name: String { "BF.MADD" } + public var key: ValkeyKey public var values: [Value] @@ -216,6 +230,8 @@ public enum BF { /// Determines if the bloom filter contains one or more items @_documentation(visibility: internal) public struct MEXISTS: ValkeyCommand { + @inlinable public static var name: String { "BF.MEXISTS" } + public var key: ValkeyKey public var values: [Value] @@ -234,6 +250,8 @@ public enum BF { /// Creates an empty bloom filter with the specified properties @_documentation(visibility: internal) public struct RESERVE: ValkeyCommand { + @inlinable public static var name: String { "BF.RESERVE" } + public var key: ValkeyKey public var errorRate: Double public var capacity: Int diff --git a/Sources/ValkeyJSON/JsonCommands.swift b/Sources/ValkeyJSON/JsonCommands.swift index b9d63c24..3660badc 100644 --- a/Sources/ValkeyJSON/JsonCommands.swift +++ b/Sources/ValkeyJSON/JsonCommands.swift @@ -28,6 +28,8 @@ public enum JSON { /// Append one or more values to the array values at the path. @_documentation(visibility: internal) public struct ARRAPPEND: ValkeyCommand { + @inlinable public static var name: String { "JSON.ARRAPPEND" } + public var key: ValkeyKey public var path: Path public var jsons: [Json] @@ -48,6 +50,8 @@ public enum JSON { /// Search for the first occurrence of a scalar JSON value in arrays located at the specified path. Indices out of range are adjusted. @_documentation(visibility: internal) public struct ARRINDEX: ValkeyCommand { + @inlinable public static var name: String { "JSON.ARRINDEX" } + public var key: ValkeyKey public var path: Path public var jsonScalar: JsonScalar @@ -72,6 +76,8 @@ public enum JSON { /// Insert one or more values into an array at the given path before the specified index. @_documentation(visibility: internal) public struct ARRINSERT: ValkeyCommand { + @inlinable public static var name: String { "JSON.ARRINSERT" } + public var key: ValkeyKey public var path: Path public var index: Int @@ -94,6 +100,8 @@ public enum JSON { /// Get length of the array at the path. @_documentation(visibility: internal) public struct ARRLEN: ValkeyCommand { + @inlinable public static var name: String { "JSON.ARRLEN" } + public var key: ValkeyKey public var path: String? @@ -112,6 +120,8 @@ public enum JSON { /// Remove and returns the element at the given index. Popping an empty array returns null. @_documentation(visibility: internal) public struct ARRPOP: ValkeyCommand { + @inlinable public static var name: String { "JSON.ARRPOP" } + public var key: ValkeyKey public var path: String? public var index: Int? @@ -132,6 +142,8 @@ public enum JSON { /// Trim the array at the path so that it becomes subarray [start, end], both inclusive. @_documentation(visibility: internal) public struct ARRTRIM: ValkeyCommand { + @inlinable public static var name: String { "JSON.ARRTRIM" } + public var key: ValkeyKey public var path: Path public var start: Int @@ -154,6 +166,8 @@ public enum JSON { /// Clear the arrays or an object at the specified path. @_documentation(visibility: internal) public struct CLEAR: ValkeyCommand { + @inlinable public static var name: String { "JSON.CLEAR" } + public var key: ValkeyKey public var path: String? @@ -172,6 +186,8 @@ public enum JSON { /// Reports information. Supported subcommands are: MEMORY, DEPTH, FIELDS, HELP @_documentation(visibility: internal) public struct DEBUG: ValkeyCommand { + @inlinable public static var name: String { "JSON.DEBUG" } + public var subcommandArguments: SubcommandArguments @inlinable public init(subcommandArguments: SubcommandArguments) { @@ -186,6 +202,8 @@ public enum JSON { /// Delete the JSON values at the specified path in a document key. @_documentation(visibility: internal) public struct DEL: ValkeyCommand { + @inlinable public static var name: String { "JSON.DEL" } + public var key: ValkeyKey public var path: String? @@ -204,6 +222,8 @@ public enum JSON { /// An alias of JSON.DEL. @_documentation(visibility: internal) public struct FORGET: ValkeyCommand { + @inlinable public static var name: String { "JSON.FORGET" } + @inlinable public init() { } @@ -215,6 +235,8 @@ public enum JSON { /// Get the serialized JSON at one or multiple paths. @_documentation(visibility: internal) public struct GET: ValkeyCommand { + @inlinable public static var name: String { "JSON.GET" } + public var key: ValkeyKey public var indentNewlineSpace: String? public var noescape: String? @@ -237,6 +259,8 @@ public enum JSON { /// Get serialized JSONs at the path from multiple document keys. Return null for non-existent key or JSON path. @_documentation(visibility: internal) public struct MGET: ValkeyCommand { + @inlinable public static var name: String { "JSON.MGET" } + public var keys: [ValkeyKey] public var path: Path @@ -278,6 +302,8 @@ public enum JSON { RESPBulkString(json).encode(into: &commandEncoder) } } + @inlinable public static var name: String { "JSON.MSET" } + public var data: [Data] @inlinable public init(data: [Data]) { @@ -294,6 +320,8 @@ public enum JSON { /// Increment the number values at the path by a given number. @_documentation(visibility: internal) public struct NUMINCRBY: ValkeyCommand { + @inlinable public static var name: String { "JSON.NUMINCRBY" } + public var key: ValkeyKey public var path: Path public var number: Int @@ -314,6 +342,8 @@ public enum JSON { /// Multiply the numeric values at the path by a given number. @_documentation(visibility: internal) public struct NUMMULTBY: ValkeyCommand { + @inlinable public static var name: String { "JSON.NUMMULTBY" } + public var key: ValkeyKey public var path: Path public var number: Int @@ -334,6 +364,8 @@ public enum JSON { /// Retrieve the key names from the objects at the specified path. @_documentation(visibility: internal) public struct OBJKEYS: ValkeyCommand { + @inlinable public static var name: String { "JSON.OBJKEYS" } + public var key: ValkeyKey public var path: String? @@ -352,6 +384,8 @@ public enum JSON { /// Get the number of keys in the object at the specified path. @_documentation(visibility: internal) public struct OBJLEN: ValkeyCommand { + @inlinable public static var name: String { "JSON.OBJLEN" } + public var key: ValkeyKey public var path: String? @@ -370,6 +404,8 @@ public enum JSON { /// Return the JSON value at the given path in Redis Serialization Protocol (RESP). @_documentation(visibility: internal) public struct RESP: ValkeyCommand { + @inlinable public static var name: String { "JSON.RESP" } + public var key: ValkeyKey public var path: String? @@ -388,6 +424,8 @@ public enum JSON { /// Set JSON values at the specified path. @_documentation(visibility: internal) public struct SET: ValkeyCommand { + @inlinable public static var name: String { "JSON.SET" } + public var key: ValkeyKey public var path: Path public var json: Json @@ -410,6 +448,8 @@ public enum JSON { /// Append a string to the JSON strings at the specified path. @_documentation(visibility: internal) public struct STRAPPEND: ValkeyCommand { + @inlinable public static var name: String { "JSON.STRAPPEND" } + public var key: ValkeyKey public var path: String? public var jsonString: JsonString @@ -430,6 +470,8 @@ public enum JSON { /// Get the length of the JSON string values at the specified path. @_documentation(visibility: internal) public struct STRLEN: ValkeyCommand { + @inlinable public static var name: String { "JSON.STRLEN" } + public var key: ValkeyKey public var path: String? @@ -448,6 +490,8 @@ public enum JSON { /// Toggle boolean values between true and false at the specified path. @_documentation(visibility: internal) public struct TOGGLE: ValkeyCommand { + @inlinable public static var name: String { "JSON.TOGGLE" } + public var key: ValkeyKey public var path: String? @@ -466,6 +510,8 @@ public enum JSON { /// Report the type of the values at the given path. @_documentation(visibility: internal) public struct TYPE: ValkeyCommand { + @inlinable public static var name: String { "JSON.TYPE" } + public var key: ValkeyKey public var path: String? diff --git a/Sources/_ValkeyCommandsBuilder/ValkeyCommandsRender.swift b/Sources/_ValkeyCommandsBuilder/ValkeyCommandsRender.swift index bed9a2c3..0f25fbd7 100644 --- a/Sources/_ValkeyCommandsBuilder/ValkeyCommandsRender.swift +++ b/Sources/_ValkeyCommandsBuilder/ValkeyCommandsRender.swift @@ -429,6 +429,8 @@ extension String { if returnType != "RESPToken" { self.append("\(tab) public typealias Response = \(returnType)\n\n") } + let name = subCommand.map { "\(commandName) \($0)" } ?? commandName + self.append("\(tab) @inlinable public static var name: String { \"\(name)\" }\n\n") if arguments.count > 0 { for arg in arguments { self.append( diff --git a/Tests/IntegrationTests/ValkeyTests.swift b/Tests/IntegrationTests/ValkeyTests.swift index 533efa46..65b63acb 100644 --- a/Tests/IntegrationTests/ValkeyTests.swift +++ b/Tests/IntegrationTests/ValkeyTests.swift @@ -75,6 +75,8 @@ struct GeneratedCommands { struct GET: ValkeyCommand { typealias Response = String? + static let name = "GET" + var key: ValkeyKey init(key: ValkeyKey) {