// commandsTransaction handles MULTI &c. func commandsTransaction(m *Miniredis, srv *redeo.Server) { srv.HandleFunc("DISCARD", m.cmdDiscard) srv.HandleFunc("EXEC", m.cmdExec) srv.HandleFunc("MULTI", m.cmdMulti) srv.HandleFunc("UNWATCH", m.cmdUnwatch) srv.HandleFunc("WATCH", m.cmdWatch) }
func commandsConnection(m *Redico, srv *redeo.Server) { srv.HandleFunc("AUTH", m.cmdAuth) srv.HandleFunc("ECHO", m.cmdEcho) srv.HandleFunc("PING", m.cmdPing) srv.HandleFunc("SELECT", m.cmdSelect) srv.HandleFunc("QUIT", m.cmdQuit) }
func commandsGeneric(m *Redico, srv *redeo.Server) { srv.HandleFunc("DEL", m.cmdDel) // DUMP srv.HandleFunc("EXISTS", m.cmdExists) srv.HandleFunc("KEYS", m.cmdKeys) srv.HandleFunc("KEYSSTART", m.cmdKeysStart) srv.HandleFunc("KEYSRANGE", m.cmdKeyRange) // OBJECT srv.HandleFunc("SCAN", m.cmdScan) }
func commandsServer(m *Miniredis, srv *redeo.Server) { srv.HandleFunc("DBSIZE", m.cmdDbsize) srv.HandleFunc("FLUSHALL", m.cmdFlushall) srv.HandleFunc("FLUSHDB", m.cmdFlushdb) }
// commandsList handles list commands (mostly L*) func commandsList(m *Miniredis, srv *redeo.Server) { // BLPOP key [key ...] timeout // BRPOP key [key ...] timeout // BRPOPLPUSH source destination timeout srv.HandleFunc("LINDEX", m.cmdLindex) srv.HandleFunc("LINSERT", m.cmdLinsert) srv.HandleFunc("LLEN", m.cmdLlen) srv.HandleFunc("LPOP", m.cmdLpop) srv.HandleFunc("LPUSH", m.cmdLpush) srv.HandleFunc("LPUSHX", m.cmdLpushx) srv.HandleFunc("LRANGE", m.cmdLrange) srv.HandleFunc("LREM", m.cmdLrem) srv.HandleFunc("LSET", m.cmdLset) srv.HandleFunc("LTRIM", m.cmdLtrim) srv.HandleFunc("RPOP", m.cmdRpop) srv.HandleFunc("RPOPLPUSH", m.cmdRpoplpush) srv.HandleFunc("RPUSH", m.cmdRpush) srv.HandleFunc("RPUSHX", m.cmdRpushx) }
// commandsHash handles all hash value operations. func commandsHash(m *Miniredis, srv *redeo.Server) { srv.HandleFunc("HDEL", m.cmdHdel) srv.HandleFunc("HEXISTS", m.cmdHexists) srv.HandleFunc("HGET", m.cmdHget) srv.HandleFunc("HGETALL", m.cmdHgetall) srv.HandleFunc("HINCRBY", m.cmdHincrby) srv.HandleFunc("HINCRBYFLOAT", m.cmdHincrbyfloat) srv.HandleFunc("HKEYS", m.cmdHkeys) srv.HandleFunc("HLEN", m.cmdHlen) srv.HandleFunc("HMGET", m.cmdHmget) srv.HandleFunc("HMSET", m.cmdHmset) srv.HandleFunc("HSET", m.cmdHset) srv.HandleFunc("HSETNX", m.cmdHsetnx) srv.HandleFunc("HVALS", m.cmdHvals) srv.HandleFunc("HSCAN", m.cmdHscan) }
// commandsSet handles all set value operations. func commandsSet(m *Miniredis, srv *redeo.Server) { srv.HandleFunc("SADD", m.cmdSadd) srv.HandleFunc("SCARD", m.cmdScard) srv.HandleFunc("SDIFF", m.cmdSdiff) srv.HandleFunc("SDIFFSTORE", m.cmdSdiffstore) srv.HandleFunc("SINTER", m.cmdSinter) srv.HandleFunc("SINTERSTORE", m.cmdSinterstore) srv.HandleFunc("SISMEMBER", m.cmdSismember) srv.HandleFunc("SMEMBERS", m.cmdSmembers) srv.HandleFunc("SMOVE", m.cmdSmove) srv.HandleFunc("SPOP", m.cmdSpop) srv.HandleFunc("SRANDMEMBER", m.cmdSrandmember) srv.HandleFunc("SREM", m.cmdSrem) srv.HandleFunc("SUNION", m.cmdSunion) srv.HandleFunc("SUNIONSTORE", m.cmdSunionstore) srv.HandleFunc("SSCAN", m.cmdSscan) }
// commandsGeneric handles EXPIRE, TTL, PERSIST, &c. func commandsGeneric(m *Miniredis, srv *redeo.Server) { srv.HandleFunc("DEL", m.cmdDel) // DUMP srv.HandleFunc("EXISTS", m.cmdExists) srv.HandleFunc("EXPIRE", makeCmdExpire(m, "expire")) srv.HandleFunc("EXPIREAT", makeCmdExpire(m, "expireat")) srv.HandleFunc("KEYS", m.cmdKeys) // MIGRATE srv.HandleFunc("MOVE", m.cmdMove) // OBJECT srv.HandleFunc("PERSIST", m.cmdPersist) srv.HandleFunc("PEXPIRE", makeCmdExpire(m, "pexpire")) srv.HandleFunc("PEXPIREAT", makeCmdExpire(m, "pexpireat")) srv.HandleFunc("PTTL", m.cmdPTTL) srv.HandleFunc("RANDOMKEY", m.cmdRandomkey) srv.HandleFunc("RENAME", m.cmdRename) srv.HandleFunc("RENAMENX", m.cmdRenamenx) // RESTORE // SORT srv.HandleFunc("TTL", m.cmdTTL) srv.HandleFunc("TYPE", m.cmdType) srv.HandleFunc("SCAN", m.cmdScan) }
// commandsString handles all string value operations. func commandsString(m *Miniredis, srv *redeo.Server) { srv.HandleFunc("APPEND", m.cmdAppend) srv.HandleFunc("BITCOUNT", m.cmdBitcount) srv.HandleFunc("BITOP", m.cmdBitop) srv.HandleFunc("BITPOS", m.cmdBitpos) srv.HandleFunc("DECRBY", m.cmdDecrby) srv.HandleFunc("DECR", m.cmdDecr) srv.HandleFunc("GETBIT", m.cmdGetbit) srv.HandleFunc("GET", m.cmdGet) srv.HandleFunc("GETRANGE", m.cmdGetrange) srv.HandleFunc("GETSET", m.cmdGetset) srv.HandleFunc("INCRBYFLOAT", m.cmdIncrbyfloat) srv.HandleFunc("INCRBY", m.cmdIncrby) srv.HandleFunc("INCR", m.cmdIncr) srv.HandleFunc("MGET", m.cmdMget) srv.HandleFunc("MSET", m.cmdMset) srv.HandleFunc("MSETNX", m.cmdMsetnx) srv.HandleFunc("PSETEX", m.cmdPsetex) srv.HandleFunc("SETBIT", m.cmdSetbit) srv.HandleFunc("SETEX", m.cmdSetex) srv.HandleFunc("SET", m.cmdSet) srv.HandleFunc("SETNX", m.cmdSetnx) srv.HandleFunc("SETRANGE", m.cmdSetrange) srv.HandleFunc("STRLEN", m.cmdStrlen) }
func commandsString(m *Redico, srv *redeo.Server) { srv.HandleFunc("GET", m.cmdGet) srv.HandleFunc("SET", m.cmdSet) srv.HandleFunc("INCR", m.cmdIncr) }
// commandsSortedSet handles all sorted set operations. func commandsSortedSet(m *Miniredis, srv *redeo.Server) { srv.HandleFunc("ZADD", m.cmdZadd) srv.HandleFunc("ZCARD", m.cmdZcard) srv.HandleFunc("ZCOUNT", m.cmdZcount) srv.HandleFunc("ZINCRBY", m.cmdZincrby) srv.HandleFunc("ZINTERSTORE", m.cmdZinterstore) srv.HandleFunc("ZLEXCOUNT", m.cmdZlexcount) srv.HandleFunc("ZRANGE", m.makeCmdZrange("zrange", false)) srv.HandleFunc("ZRANGEBYLEX", m.cmdZrangebylex) srv.HandleFunc("ZRANGEBYSCORE", m.makeCmdZrangebyscore("zrangebyscore", false)) srv.HandleFunc("ZRANK", m.makeCmdZrank("zrank", false)) srv.HandleFunc("ZREM", m.cmdZrem) srv.HandleFunc("ZREMRANGEBYLEX", m.cmdZremrangebylex) srv.HandleFunc("ZREMRANGEBYRANK", m.cmdZremrangebyrank) srv.HandleFunc("ZREMRANGEBYSCORE", m.cmdZremrangebyscore) srv.HandleFunc("ZREVRANGE", m.makeCmdZrange("zrevrange", true)) srv.HandleFunc("ZREVRANGEBYSCORE", m.makeCmdZrangebyscore("zrevrangebyscore", true)) srv.HandleFunc("ZREVRANK", m.makeCmdZrank("zrevrank", true)) srv.HandleFunc("ZSCORE", m.cmdZscore) srv.HandleFunc("ZUNIONSTORE", m.cmdZunionstore) srv.HandleFunc("ZSCAN", m.cmdZscan) }