resphelper

package
v0.0.0-...-589bc69 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 11, 2018 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package resphelper provides a number of methods for working with radix.v2 Resp structs

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UnmarshalResp

func UnmarshalResp(r *redis.Resp, i interface{}) error

UnmarshalResp takes a *redis.Resp and attemps to unmarshal its data into the given struct or pointer to a struct.

Struct fields must be of types string, []byte, int, or int64. Embedded structs and pointers to structs are also allowed

A struct field can tag itself using "resp" in order to change the name of the key it will look at when filling itself in.

type Foo struct {
	A string
	B int `resp: "bb"`
}
r := conn.Cmd("HGETALL", "foo") // retrieve resp
f := Foo{}
if err := resphelper.UnmarshalResp(r, &f); err != nil {
	// handle error
}

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL