api

package module
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PathApiV1KV       = "/api/kv/v1"
	PathApiV1KVSearch = "/api/kv/search/v1"
	PathApiV1KVList   = "/api/kv/list/v1"
)
View Source
const (
	EventKVSet = 100001
	EventKVGet = 100002
	EventKVDel = 100003
)
View Source
const (
	AuthTokenHeaderName = "x-loop-auth"
)
View Source
const (
	PathApiV1 = "/api/watch/v1"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewKV

func NewKV(c *Config) (*Client, error)

func (*Client) Delete

func (v *Client) Delete(ctx context.Context, key string) (string, error)

func (*Client) Get

func (v *Client) Get(ctx context.Context, key string) (string, error)

func (*Client) List

func (v *Client) List(ctx context.Context, prefix string) ([]KVModel, error)

func (*Client) Search

func (v *Client) Search(ctx context.Context, prefix string) ([]KVModel, error)

func (*Client) Set

func (v *Client) Set(ctx context.Context, key, value string) (string, error)

type Config

type Config struct {
	SSL       bool
	HostPort  string
	AuthToken string
}

func (Config) Validate

func (v Config) Validate() error

type KVListModel

type KVListModel []KVModel

func (KVListModel) MarshalEasyJSON

func (v KVListModel) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (KVListModel) MarshalJSON

func (v KVListModel) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*KVListModel) UnmarshalEasyJSON

func (v *KVListModel) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*KVListModel) UnmarshalJSON

func (v *KVListModel) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type KVModel

type KVModel struct {
	Key   string   `json:"key"`
	Value RawValue `json:"value,omitempty"`
}

func (KVModel) MarshalEasyJSON

func (v KVModel) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (KVModel) MarshalJSON

func (v KVModel) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*KVModel) UnmarshalEasyJSON

func (v *KVModel) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*KVModel) UnmarshalJSON

func (v *KVModel) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type RawValue

type RawValue []byte

func (RawValue) MarshalJSON

func (m RawValue) MarshalJSON() ([]byte, error)

func (RawValue) String

func (m RawValue) String() string

func (*RawValue) UnmarshalJSON

func (m *RawValue) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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