Documentation ¶
Overview ¶
Package args provides utilities for working with redigo command arguments.
Index ¶
- Variables
- func AppendAsSimpleStrings(stringArgs []string, args []interface{}) []string
- func AsSimpleString(arg interface{}) string
- func AsSimpleStrings(args []interface{}) []string
- type Info
- func (i *Info) AppendRedisBytesString(buf []byte) ([]byte, error)
- func (i *Info) BoolValue() bool
- func (i *Info) BytesValue() []byte
- func (i *Info) Complex128Value() complex128
- func (i *Info) ConvertToInt() (int64, error)
- func (i *Info) ConvertToRedisBytesString() ([]byte, error)
- func (i *Info) ConvertToRedisString() (string, error)
- func (i *Info) ConvertToUint() (uint64, error)
- func (i *Info) EqualEither(tString string, tBytes []byte) bool
- func (i *Info) EqualFoldEither(tString string, tBytes []byte) bool
- func (i *Info) Float64Value() float64
- func (i *Info) Int64Value() int64
- func (i *Info) IsStringLike() bool
- func (i *Info) IsWrapped() bool
- func (i *Info) StringValue() string
- func (i *Info) Uint64Value() uint64
- type Type
Constants ¶
This section is empty.
Variables ¶
var (
ErrInvalidTypeForOperation = errors.New("invalid type for the operation")
)
Error variables related to Info and associated functions.
Functions ¶
func AppendAsSimpleStrings ¶
AppendAsSimpleStrings appends the string form of args to the stringArgs slice. See AsSimpleString for information how conversion is performed.
func AsSimpleString ¶
func AsSimpleString(arg interface{}) string
AsSimpleString converts an argument passed to redigo's Conn.Send() method to a string. Only arguments which are sent as redis strings are converted. For all other argument types, this function returns the empty string ("").
AsSimpleString does not perform recursion and only supports one level of the redis.Argument interface. This allows inlining.
func AsSimpleStrings ¶
func AsSimpleStrings(args []interface{}) []string
AsSimpleStrings converts the elements of args to their string form. See AsSimpleString for information how conversion is performed.
Types ¶
type Info ¶
type Info struct { Arg interface{} UnwrappedArg interface{} WrappingLevel int Type Type // contains filtered or unexported fields }
func Parse ¶
func Parse(arg interface{}) Info
Parse extracts information about arg and returns an Info structure containing this information.
func (*Info) AppendRedisBytesString ¶
AppendRedisBytesString appends the argument described by i in the form of a byte slice. Depending on the type of i, a conversion might be performed. All conversions match the conversions performed by redigo when writing arguments to the connection.
func (*Info) BytesValue ¶
func (*Info) Complex128Value ¶
func (i *Info) Complex128Value() complex128
func (*Info) ConvertToInt ¶
ConvertToInt returns the argument described by i in the form of an int64. Depending on the type of i, a conversion might be performed. Any error occuring during conversion is returned.
TODO: Can Nil be converted to an int?
func (*Info) ConvertToRedisBytesString ¶
ConvertToRedisBytesString returns the argument described by i in the form of a byte slice. If i is a byte slice, a reference is returned instead of a copy. The returned slice must not be modified to ensure the consistency of i. Depending on the type of i, a conversion might be performed. All conversions match the conversions performed by redigo when writing arguments to the connection.
func (*Info) ConvertToRedisString ¶
ConvertToRedisString returns the argument described by i in the form of a string. Depending on the type of i, a conversion might be performed. All conversions match the conversions performed by redigo when writing arguments to the connection.
func (*Info) ConvertToUint ¶
ConvertToUint returns the argument described by i in the form of an uint64. Depending on the type of i, a conversion might be performed. Any error occuring during conversion is returned.
TODO: Can Nil be converted to a uint?
func (*Info) EqualEither ¶
EqualEither checks string equality of i to either tString OR tBytes using whichever matches the type of i.
func (*Info) EqualFoldEither ¶
EqualEither checks string equality under unicode case folding of i to either tString OR tBytes using whichever matches the type of i.
func (*Info) Float64Value ¶
func (*Info) Int64Value ¶
func (*Info) IsStringLike ¶
IsStringLike returns true iff i describes either a String or Bytes argument.
func (*Info) IsWrapped ¶
IsWrapped returns true iff i describes an argument wrapped in redis.Argument at least once.