kv

package
v0.0.0-...-2ff8efa Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("key not found")

Functions

func Key

func Key(indexes ...string) string

func NewSession

func NewSession(kv KV, key string) telegram.SessionStorage

Types

type Bolt

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

func (*Bolt) Delete

func (b *Bolt) Delete(key string) error

func (*Bolt) Get

func (b *Bolt) Get(key string) ([]byte, error)

func (*Bolt) Set

func (b *Bolt) Set(key string, val []byte) error

type KV

type KV interface {
	Get(key string) ([]byte, error)
	Set(key string, value []byte) error
	Delete(key string) error
}

func New

func New(opts Options) (KV, error)

func NewBoltKV

func NewBoltKV(cnf *config.Config) KV

type Options

type Options struct {
	Bucket string
	DB     *bbolt.DB
}

type Session

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

func (*Session) LoadSession

func (s *Session) LoadSession(_ context.Context) ([]byte, error)

func (*Session) StoreSession

func (s *Session) StoreSession(_ context.Context, data []byte) error

Jump to

Keyboard shortcuts

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