kv

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type InMemory

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

func NewInMemory

func NewInMemory() *InMemory

func (*InMemory) GetAny

func (i *InMemory) GetAny(ctx context.Context, key string, valuePtr any) error

func (*InMemory) GetBytes

func (i *InMemory) GetBytes(_ context.Context, key string) ([]byte, error)

func (*InMemory) GetString

func (i *InMemory) GetString(ctx context.Context, key string) (string, error)

func (*InMemory) GetTTL

func (i *InMemory) GetTTL(ctx context.Context, key string) (*time.Duration, error)

func (*InMemory) Key

func (i *InMemory) Key(args ...string) string

func (*InMemory) SetAny

func (i *InMemory) SetAny(_ context.Context, key string, value any) error

func (*InMemory) SetBytes

func (i *InMemory) SetBytes(_ context.Context, key string, value []byte) error

func (*InMemory) SetString

func (i *InMemory) SetString(_ context.Context, key, value string) error

func (*InMemory) SetTTL

func (i *InMemory) SetTTL(ctx context.Context, key string, ttl time.Duration) error

type KV

type KV interface {
	WriteApi
	ReadApi
	Keyable
}

type Keyable

type Keyable interface {
	Key(args ...string) string
}

type ReadApi

type ReadApi interface {
	GetBytes(ctx context.Context, key string) ([]byte, error)
	GetString(ctx context.Context, key string) (string, error)
	GetAny(ctx context.Context, key string, valuePtr any) error
	GetTTL(ctx context.Context, key string) (*time.Duration, error)
}

type WriteApi

type WriteApi interface {
	SetBytes(ctx context.Context, key string, value []byte) error
	SetString(ctx context.Context, key, value string) error
	SetAny(ctx context.Context, key string, value any) error
	SetTTL(ctx context.Context, key string, ttl time.Duration) error
}

Jump to

Keyboard shortcuts

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