diff --git a/redis/wrapper.go b/redis/wrapper.go index 46c8ed3..09edea0 100644 --- a/redis/wrapper.go +++ b/redis/wrapper.go @@ -48,6 +48,18 @@ func Publish(channel string, message interface{}) (*_redis.IntCmd) { return rdb.Publish(redisCtx, channel, message) } +func XAdd(stream string, id string, maxlen int64, message map[string]interface{}) (*_redis.StringCmd) { + + args := &_redis.XAddArgs{ + Stream: stream, + ID: id, + MaxLenApprox: maxlen, + Values: message, + } + + return rdb.XAdd(redisCtx, args) +} + func RegisterPublish(channel string, message interface{}) (*_redis.IntCmd) { return redis_pipe.Publish(redisCtx, channel, message) }