Example #1
0
//
// Return the float64 pointer in the Redis Reply
//
// Redis/Casting Error --> error
// Cache Miss          --> nil ptr
// Cache Hit           --> valid ptr
//
func ReplyToFloat64Ptr(reply *redis.Reply) (*float64, error) {
	switch {
	case nil != reply.Err:
		return nil, reply.Err
	case redis.NilReply == reply.Type:
		return nil, nil
	default:
		value, err := reply.Float64()
		if nil != err {
			return nil, err
		}
		return &value, nil
	}
}