Documentation ¶
Index ¶
- func GetHKeyName(ctx context.Context) string
- func GetIndex(ctx context.Context) int
- func GetKeyName(ctx context.Context) string
- func JSON(w http.ResponseWriter, v interface{})
- func RequireHKeyName(next http.Handler) http.Handler
- func RequireHSetParams(next http.Handler) http.Handler
- func RequireIndex(next http.Handler) http.Handler
- func RequireKeyName(next http.Handler) http.Handler
- func RequireRPushParams(next http.Handler) http.Handler
- func RequireSetParams(next http.Handler) http.Handler
- func Routes(b *backend.Backend) http.Handler
- type HSetRequestBody
- type RPushRequestBody
- type SetRequestBody
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetHKeyName ¶
GetKeyName retrieves hash map key name value from context.
func GetKeyName ¶
GetKeyName retrieves key name value from context.
func JSON ¶
func JSON(w http.ResponseWriter, v interface{})
JSON marshals 'v' to JSON, automatically escaping HTML and setting the Content-Type as application/json. It will call http.Error in case of failures.
func RequireHKeyName ¶
RequireHKeyName middleware checks that 'hkey' parameter is set.
func RequireHSetParams ¶
RequireHSetParams validates request body for 'hset' operation.
func RequireIndex ¶
RequireIndex middleware checks that 'index' parameter is set.
func RequireKeyName ¶
RequireKeyName middleware checks that 'key' parameter is set.
func RequireRPushParams ¶
RequireRPushParams validates request body for 'rpush' operation.
func RequireSetParams ¶
RequireSetParams validates request body for 'set' operation.
Types ¶
type HSetRequestBody ¶
type HSetRequestBody struct { Key string `json:"key"` Value map[string]interface{} `json:"value"` TTL int `json:"ttl"` }
HSetRequestBody represents hset request body.
func GetHSetBody ¶
func GetHSetBody(ctx context.Context) *HSetRequestBody
GetHSetBody retrieves set body from context.
func (*HSetRequestBody) IsValid ¶
func (b *HSetRequestBody) IsValid() bool
type RPushRequestBody ¶
type RPushRequestBody struct { Key string `json:"key"` Value interface{} `json:"value"` TTL int `json:"ttl"` }
RPushRequestBody represents rpush request body.
func GetRPushBody ¶
func GetRPushBody(ctx context.Context) *RPushRequestBody
GetRPushBody retrieves set body from context.
func (*RPushRequestBody) IsValid ¶
func (b *RPushRequestBody) IsValid() bool
type SetRequestBody ¶
type SetRequestBody struct { Key string `json:"key"` Value interface{} `json:"value"` TTL int `json:"ttl"` }
SetRequestBody represents set request body.
func GetSetBody ¶
func GetSetBody(ctx context.Context) *SetRequestBody
GetSetBody retrieves set body from context.
func (*SetRequestBody) IsValid ¶
func (b *SetRequestBody) IsValid() bool