client

package
v0.0.0-...-35ce087 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CodeSuccess       = 0
	CodeInternalError = 5000
	CodeBadRequest    = 5001
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultKaeyaClient

type DefaultKaeyaClient struct {
	// contains filtered or unexported fields
}

func NewDefaultKaeyaClient

func NewDefaultKaeyaClient(addr string, options ...Option) *DefaultKaeyaClient

func (*DefaultKaeyaClient) Get

func (d *DefaultKaeyaClient) Get(ctx context.Context, key string) (domain.KV, error)

func (*DefaultKaeyaClient) Set

func (d *DefaultKaeyaClient) Set(ctx context.Context, kv domain.KV) error

type Getter

type Getter interface {
	Get(ctx context.Context, key string) (domain.KV, error)
}

type KVData

type KVData struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type KVDataResponse

type KVDataResponse struct {
	Response
	Data KVData `json:"data"`
}

type KaeyaClient

type KaeyaClient interface {
	Getter
	Setter
}

type Option

type Option func(opts *clientopts)

func WithHttpClient

func WithHttpClient(c *http.Client) Option

type Response

type Response struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

type Setter

type Setter interface {
	Set(ctx context.Context, kv domain.KV) error
}

Jump to

Keyboard shortcuts

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