storage

package
v0.17.2 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const SEP = '/'

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*clientv3.Client
	// contains filtered or unexported fields
}

func NewClient

func NewClient(prefix string, logger *zap.Logger, debug bool, endpoints ...string) *Client

func (*Client) Config

func (c *Client) Config() clientv3.Config

func (*Client) Delete added in v0.4.9

func (c *Client) Delete(ctx context.Context, key string, opts ...clientv3.OpOption) (*clientv3.DeleteResponse, error)

func (*Client) Get added in v0.4.9

func (c *Client) Get(ctx context.Context, key string, opts ...clientv3.OpOption) (*clientv3.GetResponse, error)

func (*Client) Key

func (c *Client) Key(parts ...string) *Key

func (*Client) Put added in v0.4.9

func (c *Client) Put(ctx context.Context, key string, val string, opts ...clientv3.OpOption) (*clientv3.PutResponse, error)

func (*Client) WithHooks added in v0.16.0

func (c *Client) WithHooks(hooks ...StorageHook) *Client

type Key

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

func (*Key) Add

func (k *Key) Add(parts ...string) *Key

func (*Key) Copy

func (k *Key) Copy() *Key

func (*Key) IsPrefix added in v0.3.5

func (k *Key) IsPrefix() bool

func (*Key) Prefix

func (k *Key) Prefix(val bool) *Key

func (*Key) String

func (k *Key) String() string

type StorageHook added in v0.16.0

type StorageHook struct {
	GetPre    func(ctx context.Context, key string, opts ...clientv3.OpOption) error
	PutPre    func(ctx context.Context, key string, val string, opts ...clientv3.OpOption) error
	DeletePre func(ctx context.Context, key string, opts ...clientv3.OpOption) error

	GetPost    func(ctx context.Context, key string, res *clientv3.GetResponse, opts ...clientv3.OpOption) (*clientv3.GetResponse, error)
	PutPost    func(ctx context.Context, key string, val string, res *clientv3.PutResponse, opts ...clientv3.OpOption) (*clientv3.PutResponse, error)
	DeletePost func(ctx context.Context, key string, res *clientv3.DeleteResponse, opts ...clientv3.OpOption) (*clientv3.DeleteResponse, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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