v1

package
v0.0.0-...-a88ee92 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2020 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetHKeyName

func GetHKeyName(ctx context.Context) string

GetKeyName retrieves hash map key name value from context.

func GetIndex

func GetIndex(ctx context.Context) int

GetIndex retrieves index value from context.

func GetKeyName

func GetKeyName(ctx context.Context) string

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

func RequireHKeyName(next http.Handler) http.Handler

RequireHKeyName middleware checks that 'hkey' parameter is set.

func RequireHSetParams

func RequireHSetParams(next http.Handler) http.Handler

RequireHSetParams validates request body for 'hset' operation.

func RequireIndex

func RequireIndex(next http.Handler) http.Handler

RequireIndex middleware checks that 'index' parameter is set.

func RequireKeyName

func RequireKeyName(next http.Handler) http.Handler

RequireKeyName middleware checks that 'key' parameter is set.

func RequireRPushParams

func RequireRPushParams(next http.Handler) http.Handler

RequireRPushParams validates request body for 'rpush' operation.

func RequireSetParams

func RequireSetParams(next http.Handler) http.Handler

RequireSetParams validates request body for 'set' operation.

func Routes

func Routes(b *backend.Backend) http.Handler

Routes initializes v1 handler.

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

Jump to

Keyboard shortcuts

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