feat: add SetVal method for each command

This commit is contained in:
Stavros Panakakakis 2021-09-25 18:12:26 +03:00
parent afd8445978
commit 168981da2d
1 changed files with 143 additions and 0 deletions

View File

@ -200,6 +200,10 @@ func (cmd *Cmd) String() string {
return cmdString(cmd, cmd.val)
}
func (cmd *Cmd) SetVal(val interface{}) {
cmd.val = val
}
func (cmd *Cmd) Val() interface{} {
return cmd.val
}
@ -372,6 +376,10 @@ func NewSliceCmd(ctx context.Context, args ...interface{}) *SliceCmd {
}
}
func (cmd *SliceCmd) SetVal(val []interface{}) {
cmd.val = val
}
func (cmd *SliceCmd) Val() []interface{} {
return cmd.val
}
@ -432,6 +440,10 @@ func NewStatusCmd(ctx context.Context, args ...interface{}) *StatusCmd {
}
}
func (cmd *StatusCmd) SetVal(val string) {
cmd.val = val
}
func (cmd *StatusCmd) Val() string {
return cmd.val
}
@ -468,6 +480,10 @@ func NewIntCmd(ctx context.Context, args ...interface{}) *IntCmd {
}
}
func (cmd *IntCmd) SetVal(val int64) {
cmd.val = val
}
func (cmd *IntCmd) Val() int64 {
return cmd.val
}
@ -508,6 +524,10 @@ func NewIntSliceCmd(ctx context.Context, args ...interface{}) *IntSliceCmd {
}
}
func (cmd *IntSliceCmd) SetVal(val []int64) {
cmd.val = val
}
func (cmd *IntSliceCmd) Val() []int64 {
return cmd.val
}
@ -556,6 +576,10 @@ func NewDurationCmd(ctx context.Context, precision time.Duration, args ...interf
}
}
func (cmd *DurationCmd) SetVal(val time.Duration) {
cmd.val = val
}
func (cmd *DurationCmd) Val() time.Duration {
return cmd.val
}
@ -603,6 +627,10 @@ func NewTimeCmd(ctx context.Context, args ...interface{}) *TimeCmd {
}
}
func (cmd *TimeCmd) SetVal(val time.Time) {
cmd.val = val
}
func (cmd *TimeCmd) Val() time.Time {
return cmd.val
}
@ -656,6 +684,10 @@ func NewBoolCmd(ctx context.Context, args ...interface{}) *BoolCmd {
}
}
func (cmd *BoolCmd) SetVal(val bool) {
cmd.val = val
}
func (cmd *BoolCmd) Val() bool {
return cmd.val
}
@ -710,6 +742,10 @@ func NewStringCmd(ctx context.Context, args ...interface{}) *StringCmd {
}
}
func (cmd *StringCmd) SetVal(val string) {
cmd.val = val
}
func (cmd *StringCmd) Val() string {
return cmd.val
}
@ -810,6 +846,10 @@ func NewFloatCmd(ctx context.Context, args ...interface{}) *FloatCmd {
}
}
func (cmd *FloatCmd) SetVal(val float64) {
cmd.val = val
}
func (cmd *FloatCmd) Val() float64 {
return cmd.val
}
@ -846,6 +886,10 @@ func NewFloatSliceCmd(ctx context.Context, args ...interface{}) *FloatSliceCmd {
}
}
func (cmd *FloatSliceCmd) SetVal(val []float64) {
cmd.val = val
}
func (cmd *FloatSliceCmd) Val() []float64 {
return cmd.val
}
@ -895,6 +939,10 @@ func NewStringSliceCmd(ctx context.Context, args ...interface{}) *StringSliceCmd
}
}
func (cmd *StringSliceCmd) SetVal(val []string) {
cmd.val = val
}
func (cmd *StringSliceCmd) Val() []string {
return cmd.val
}
@ -948,6 +996,10 @@ func NewBoolSliceCmd(ctx context.Context, args ...interface{}) *BoolSliceCmd {
}
}
func (cmd *BoolSliceCmd) SetVal(val []bool) {
cmd.val = val
}
func (cmd *BoolSliceCmd) Val() []bool {
return cmd.val
}
@ -994,6 +1046,10 @@ func NewStringStringMapCmd(ctx context.Context, args ...interface{}) *StringStri
}
}
func (cmd *StringStringMapCmd) SetVal(val map[string]string) {
cmd.val = val
}
func (cmd *StringStringMapCmd) Val() map[string]string {
return cmd.val
}
@ -1067,6 +1123,10 @@ func NewStringIntMapCmd(ctx context.Context, args ...interface{}) *StringIntMapC
}
}
func (cmd *StringIntMapCmd) SetVal(val map[string]int64) {
cmd.val = val
}
func (cmd *StringIntMapCmd) Val() map[string]int64 {
return cmd.val
}
@ -1119,6 +1179,10 @@ func NewStringStructMapCmd(ctx context.Context, args ...interface{}) *StringStru
}
}
func (cmd *StringStructMapCmd) SetVal(val map[string]struct{}) {
cmd.val = val
}
func (cmd *StringStructMapCmd) Val() map[string]struct{} {
return cmd.val
}
@ -1170,6 +1234,10 @@ func NewXMessageSliceCmd(ctx context.Context, args ...interface{}) *XMessageSlic
}
}
func (cmd *XMessageSliceCmd) SetVal(val []XMessage) {
cmd.val = val
}
func (cmd *XMessageSliceCmd) Val() []XMessage {
return cmd.val
}
@ -1279,6 +1347,10 @@ func NewXStreamSliceCmd(ctx context.Context, args ...interface{}) *XStreamSliceC
}
}
func (cmd *XStreamSliceCmd) SetVal(val []XStream) {
cmd.val = val
}
func (cmd *XStreamSliceCmd) Val() []XStream {
return cmd.val
}
@ -1351,6 +1423,10 @@ func NewXPendingCmd(ctx context.Context, args ...interface{}) *XPendingCmd {
}
}
func (cmd *XPendingCmd) SetVal(val *XPending) {
cmd.val = val
}
func (cmd *XPendingCmd) Val() *XPending {
return cmd.val
}
@ -1453,6 +1529,10 @@ func NewXPendingExtCmd(ctx context.Context, args ...interface{}) *XPendingExtCmd
}
}
func (cmd *XPendingExtCmd) SetVal(val []XPendingExt) {
cmd.val = val
}
func (cmd *XPendingExtCmd) Val() []XPendingExt {
return cmd.val
}
@ -1531,6 +1611,11 @@ func NewXAutoClaimCmd(ctx context.Context, args ...interface{}) *XAutoClaimCmd {
}
}
func (cmd *XAutoClaimCmd) SetVal(val []XMessage, start string) {
cmd.val = val
cmd.start = start
}
func (cmd *XAutoClaimCmd) Val() (messages []XMessage, start string) {
return cmd.val, cmd.start
}
@ -1585,6 +1670,11 @@ func NewXAutoClaimJustIDCmd(ctx context.Context, args ...interface{}) *XAutoClai
}
}
func (cmd *XAutoClaimJustIDCmd) SetVal(val []string, start string) {
cmd.val = val
cmd.start = start
}
func (cmd *XAutoClaimJustIDCmd) Val() (ids []string, start string) {
return cmd.val, cmd.start
}
@ -1651,6 +1741,10 @@ func NewXInfoConsumersCmd(ctx context.Context, stream string, group string) *XIn
}
}
func (cmd *XInfoConsumersCmd) SetVal(val []XInfoConsumer) {
cmd.val = val
}
func (cmd *XInfoConsumersCmd) Val() []XInfoConsumer {
return cmd.val
}
@ -1749,6 +1843,10 @@ func NewXInfoGroupsCmd(ctx context.Context, stream string) *XInfoGroupsCmd {
}
}
func (cmd *XInfoGroupsCmd) SetVal(val []XInfoGroup) {
cmd.val = val
}
func (cmd *XInfoGroupsCmd) Val() []XInfoGroup {
return cmd.val
}
@ -1852,6 +1950,10 @@ func NewXInfoStreamCmd(ctx context.Context, stream string) *XInfoStreamCmd {
}
}
func (cmd *XInfoStreamCmd) SetVal(val *XInfoStream) {
cmd.val = val
}
func (cmd *XInfoStreamCmd) Val() *XInfoStream {
return cmd.val
}
@ -1971,6 +2073,10 @@ func NewXInfoStreamFullCmd(ctx context.Context, args ...interface{}) *XInfoStrea
}
}
func (cmd *XInfoStreamFullCmd) SetVal(val *XInfoStreamFull) {
cmd.val = val
}
func (cmd *XInfoStreamFullCmd) Val() *XInfoStreamFull {
return cmd.val
}
@ -2231,6 +2337,10 @@ func NewZSliceCmd(ctx context.Context, args ...interface{}) *ZSliceCmd {
}
}
func (cmd *ZSliceCmd) SetVal(val []Z) {
cmd.val = val
}
func (cmd *ZSliceCmd) Val() []Z {
return cmd.val
}
@ -2286,6 +2396,10 @@ func NewZWithKeyCmd(ctx context.Context, args ...interface{}) *ZWithKeyCmd {
}
}
func (cmd *ZWithKeyCmd) SetVal(val *ZWithKey) {
cmd.val = val
}
func (cmd *ZWithKeyCmd) Val() *ZWithKey {
return cmd.val
}
@ -2350,6 +2464,11 @@ func NewScanCmd(ctx context.Context, process cmdable, args ...interface{}) *Scan
}
}
func (cmd *ScanCmd) SetVal(page []string, cursor uint64) {
cmd.page = page
cmd.cursor = cursor
}
func (cmd *ScanCmd) Val() (keys []string, cursor uint64) {
return cmd.page, cmd.cursor
}
@ -2404,6 +2523,10 @@ func NewClusterSlotsCmd(ctx context.Context, args ...interface{}) *ClusterSlotsC
}
}
func (cmd *ClusterSlotsCmd) SetVal(val []ClusterSlot) {
cmd.val = val
}
func (cmd *ClusterSlotsCmd) Val() []ClusterSlot {
return cmd.val
}
@ -2558,6 +2681,10 @@ func geoLocationArgs(q *GeoRadiusQuery, args ...interface{}) []interface{} {
return args
}
func (cmd *GeoLocationCmd) SetVal(locations []GeoLocation) {
cmd.locations = locations
}
func (cmd *GeoLocationCmd) Val() []GeoLocation {
return cmd.locations
}
@ -2761,6 +2888,10 @@ func NewGeoSearchLocationCmd(
}
}
func (cmd *GeoSearchLocationCmd) SetVal(val []GeoLocation) {
cmd.val = val
}
func (cmd *GeoSearchLocationCmd) Val() []GeoLocation {
return cmd.val
}
@ -2852,6 +2983,10 @@ func NewGeoPosCmd(ctx context.Context, args ...interface{}) *GeoPosCmd {
}
}
func (cmd *GeoPosCmd) SetVal(val []*GeoPos) {
cmd.val = val
}
func (cmd *GeoPosCmd) Val() []*GeoPos {
return cmd.val
}
@ -2929,6 +3064,10 @@ func NewCommandsInfoCmd(ctx context.Context, args ...interface{}) *CommandsInfoC
}
}
func (cmd *CommandsInfoCmd) SetVal(val map[string]*CommandInfo) {
cmd.val = val
}
func (cmd *CommandsInfoCmd) Val() map[string]*CommandInfo {
return cmd.val
}
@ -3116,6 +3255,10 @@ func NewSlowLogCmd(ctx context.Context, args ...interface{}) *SlowLogCmd {
}
}
func (cmd *SlowLogCmd) SetVal(val []SlowLog) {
cmd.val = val
}
func (cmd *SlowLogCmd) Val() []SlowLog {
return cmd.val
}