2019-04-08 12:05:15 +03:00
package redis
import "time"
2021-02-11 00:28:32 +03:00
// NewCmdResult returns a Cmd initialised with val and err for testing.
2019-04-08 12:05:15 +03:00
func NewCmdResult ( val interface { } , err error ) * Cmd {
var cmd Cmd
cmd . val = val
2020-09-28 00:09:46 +03:00
cmd . SetErr ( err )
2019-04-08 12:05:15 +03:00
return & cmd
}
2021-02-11 00:28:32 +03:00
// NewSliceResult returns a SliceCmd initialised with val and err for testing.
2019-04-08 12:05:15 +03:00
func NewSliceResult ( val [ ] interface { } , err error ) * SliceCmd {
var cmd SliceCmd
cmd . val = val
2020-09-28 00:09:46 +03:00
cmd . SetErr ( err )
2019-04-08 12:05:15 +03:00
return & cmd
}
2021-02-11 00:28:32 +03:00
// NewStatusResult returns a StatusCmd initialised with val and err for testing.
2019-04-08 12:05:15 +03:00
func NewStatusResult ( val string , err error ) * StatusCmd {
var cmd StatusCmd
cmd . val = val
2020-09-28 00:09:46 +03:00
cmd . SetErr ( err )
2019-04-08 12:05:15 +03:00
return & cmd
}
2021-02-11 00:28:32 +03:00
// NewIntResult returns an IntCmd initialised with val and err for testing.
2019-04-08 12:05:15 +03:00
func NewIntResult ( val int64 , err error ) * IntCmd {
var cmd IntCmd
cmd . val = val
2020-09-28 00:09:46 +03:00
cmd . SetErr ( err )
2019-04-08 12:05:15 +03:00
return & cmd
}
2021-02-11 00:28:32 +03:00
// NewDurationResult returns a DurationCmd initialised with val and err for testing.
2019-04-08 12:05:15 +03:00
func NewDurationResult ( val time . Duration , err error ) * DurationCmd {
var cmd DurationCmd
cmd . val = val
2020-09-28 00:09:46 +03:00
cmd . SetErr ( err )
2019-04-08 12:05:15 +03:00
return & cmd
}
2021-02-11 00:28:32 +03:00
// NewBoolResult returns a BoolCmd initialised with val and err for testing.
2019-04-08 12:05:15 +03:00
func NewBoolResult ( val bool , err error ) * BoolCmd {
var cmd BoolCmd
cmd . val = val
2020-09-28 00:09:46 +03:00
cmd . SetErr ( err )
2019-04-08 12:05:15 +03:00
return & cmd
}
2021-02-11 00:28:32 +03:00
// NewStringResult returns a StringCmd initialised with val and err for testing.
2019-04-08 12:05:15 +03:00
func NewStringResult ( val string , err error ) * StringCmd {
var cmd StringCmd
cmd . val = val
2020-09-28 00:09:46 +03:00
cmd . SetErr ( err )
2019-04-08 12:05:15 +03:00
return & cmd
}
2021-02-11 00:28:32 +03:00
// NewFloatResult returns a FloatCmd initialised with val and err for testing.
2019-04-08 12:05:15 +03:00
func NewFloatResult ( val float64 , err error ) * FloatCmd {
var cmd FloatCmd
cmd . val = val
2020-09-28 00:09:46 +03:00
cmd . SetErr ( err )
2019-04-08 12:05:15 +03:00
return & cmd
}
2021-02-11 00:28:32 +03:00
// NewStringSliceResult returns a StringSliceCmd initialised with val and err for testing.
2019-04-08 12:05:15 +03:00
func NewStringSliceResult ( val [ ] string , err error ) * StringSliceCmd {
var cmd StringSliceCmd
cmd . val = val
2020-09-28 00:09:46 +03:00
cmd . SetErr ( err )
2019-04-08 12:05:15 +03:00
return & cmd
}
2021-02-11 00:28:32 +03:00
// NewBoolSliceResult returns a BoolSliceCmd initialised with val and err for testing.
2019-04-08 12:05:15 +03:00
func NewBoolSliceResult ( val [ ] bool , err error ) * BoolSliceCmd {
var cmd BoolSliceCmd
cmd . val = val
2020-09-28 00:09:46 +03:00
cmd . SetErr ( err )
2019-04-08 12:05:15 +03:00
return & cmd
}
2021-02-11 00:28:32 +03:00
// NewStringStringMapResult returns a StringStringMapCmd initialised with val and err for testing.
2019-04-08 12:05:15 +03:00
func NewStringStringMapResult ( val map [ string ] string , err error ) * StringStringMapCmd {
var cmd StringStringMapCmd
cmd . val = val
2020-09-28 00:09:46 +03:00
cmd . SetErr ( err )
2019-04-08 12:05:15 +03:00
return & cmd
}
2021-02-11 00:28:32 +03:00
// NewStringIntMapCmdResult returns a StringIntMapCmd initialised with val and err for testing.
2019-04-08 12:05:15 +03:00
func NewStringIntMapCmdResult ( val map [ string ] int64 , err error ) * StringIntMapCmd {
var cmd StringIntMapCmd
cmd . val = val
2020-09-28 00:09:46 +03:00
cmd . SetErr ( err )
return & cmd
}
2021-02-11 00:28:32 +03:00
// NewTimeCmdResult returns a TimeCmd initialised with val and err for testing.
2020-09-28 00:09:46 +03:00
func NewTimeCmdResult ( val time . Time , err error ) * TimeCmd {
var cmd TimeCmd
cmd . val = val
cmd . SetErr ( err )
2019-04-08 12:05:15 +03:00
return & cmd
}
2021-02-11 00:28:32 +03:00
// NewZSliceCmdResult returns a ZSliceCmd initialised with val and err for testing.
2019-04-08 12:05:15 +03:00
func NewZSliceCmdResult ( val [ ] Z , err error ) * ZSliceCmd {
var cmd ZSliceCmd
cmd . val = val
2020-09-28 00:09:46 +03:00
cmd . SetErr ( err )
return & cmd
}
2021-02-11 00:28:32 +03:00
// NewZWithKeyCmdResult returns a NewZWithKeyCmd initialised with val and err for testing.
2020-09-28 00:09:46 +03:00
func NewZWithKeyCmdResult ( val * ZWithKey , err error ) * ZWithKeyCmd {
var cmd ZWithKeyCmd
cmd . val = val
cmd . SetErr ( err )
2019-04-08 12:05:15 +03:00
return & cmd
}
2021-02-11 00:28:32 +03:00
// NewScanCmdResult returns a ScanCmd initialised with val and err for testing.
2019-04-08 12:05:15 +03:00
func NewScanCmdResult ( keys [ ] string , cursor uint64 , err error ) * ScanCmd {
var cmd ScanCmd
cmd . page = keys
cmd . cursor = cursor
2020-09-28 00:09:46 +03:00
cmd . SetErr ( err )
2019-04-08 12:05:15 +03:00
return & cmd
}
2021-02-11 00:28:32 +03:00
// NewClusterSlotsCmdResult returns a ClusterSlotsCmd initialised with val and err for testing.
2019-04-08 12:05:15 +03:00
func NewClusterSlotsCmdResult ( val [ ] ClusterSlot , err error ) * ClusterSlotsCmd {
var cmd ClusterSlotsCmd
cmd . val = val
2020-09-28 00:09:46 +03:00
cmd . SetErr ( err )
2019-04-08 12:05:15 +03:00
return & cmd
}
2021-02-11 00:28:32 +03:00
// NewGeoLocationCmdResult returns a GeoLocationCmd initialised with val and err for testing.
2019-04-08 12:05:15 +03:00
func NewGeoLocationCmdResult ( val [ ] GeoLocation , err error ) * GeoLocationCmd {
var cmd GeoLocationCmd
cmd . locations = val
2020-09-28 00:09:46 +03:00
cmd . SetErr ( err )
return & cmd
}
2021-02-11 00:28:32 +03:00
// NewGeoPosCmdResult returns a GeoPosCmd initialised with val and err for testing.
2020-09-28 00:09:46 +03:00
func NewGeoPosCmdResult ( val [ ] * GeoPos , err error ) * GeoPosCmd {
var cmd GeoPosCmd
cmd . val = val
cmd . SetErr ( err )
2019-04-08 12:05:15 +03:00
return & cmd
}
2021-02-11 00:28:32 +03:00
// NewCommandsInfoCmdResult returns a CommandsInfoCmd initialised with val and err for testing.
2019-04-08 12:05:15 +03:00
func NewCommandsInfoCmdResult ( val map [ string ] * CommandInfo , err error ) * CommandsInfoCmd {
var cmd CommandsInfoCmd
cmd . val = val
2020-09-28 00:09:46 +03:00
cmd . SetErr ( err )
return & cmd
}
2021-02-11 00:28:32 +03:00
// NewXMessageSliceCmdResult returns a XMessageSliceCmd initialised with val and err for testing.
2020-09-28 00:09:46 +03:00
func NewXMessageSliceCmdResult ( val [ ] XMessage , err error ) * XMessageSliceCmd {
var cmd XMessageSliceCmd
cmd . val = val
cmd . SetErr ( err )
return & cmd
}
2021-02-11 00:28:32 +03:00
// NewXStreamSliceCmdResult returns a XStreamSliceCmd initialised with val and err for testing.
2020-09-28 00:09:46 +03:00
func NewXStreamSliceCmdResult ( val [ ] XStream , err error ) * XStreamSliceCmd {
var cmd XStreamSliceCmd
cmd . val = val
cmd . SetErr ( err )
2019-04-08 12:05:15 +03:00
return & cmd
}