goukv: github.com/alash3al/goukv Index | Files | Directories

package goukv

import "github.com/alash3al/goukv"


Package Files

dsn.go entry.go errors.go provider.go scan.go


var (
    ErrDriverAlreadyExists = errors.New("the specified driver name is already exisrs")
    ErrDriverNotFound      = errors.New("the requested driver isn't found")
    ErrKeyExpired          = errors.New("the specified key is expired")
    ErrKeyNotFound         = errors.New("the specified key couldn't be found")

error related variables

func Register Uses

func Register(name string, provider Provider) error

Register register a new driver

type DSN Uses

type DSN struct {
    // contains filtered or unexported fields

DSN data source name

func NewDSN Uses

func NewDSN(dsn string) (*DSN, error)

NewDSN initializes a new dsn by parsing the specified dsn

func (DSN) GetBool Uses

func (dsn DSN) GetBool(key string) bool

GetInt returns the value of the key as bool

func (DSN) GetFloat Uses

func (dsn DSN) GetFloat(key string) float64

GetInt returns the value of the key as float64

func (DSN) GetInt Uses

func (dsn DSN) GetInt(key string) int

GetInt returns the value of the key as int

func (DSN) GetInt64 Uses

func (dsn DSN) GetInt64(key string) int64

GetInt returns the value of the key as int64

func (DSN) GetString Uses

func (dsn DSN) GetString(key string) string

GetString fetches an option from the options as string

func (DSN) Hostname Uses

func (dsn DSN) Hostname() string

Hostname returns the dsn hostname

func (DSN) Password Uses

func (dsn DSN) Password() string

Password returns the password

func (DSN) Path Uses

func (dsn DSN) Path() string

Path returns the dsn path

func (DSN) Port Uses

func (dsn DSN) Port() string

Port returns the dsn port number as string

func (DSN) Scheme Uses

func (dsn DSN) Scheme() string

Scheme returns the dsn scheme

func (DSN) Username Uses

func (dsn DSN) Username() string

Username returns the dsn username

type Entry Uses

type Entry struct {
    Key   []byte
    Value []byte
    TTL   time.Duration

Entry represents a key - value pair

type Provider Uses

type Provider interface {
    Open(*DSN) (Provider, error)
    Put(*Entry) error
    Get([]byte) ([]byte, error)
    TTL([]byte) (*time.Time, error)
    Delete([]byte) error
    Batch([]*Entry) error
    Scan(ScanOpts) error
    Close() error

Provider an interface describes a storage backend

func Get Uses

func Get(providerName string) (Provider, error)

Get returns a driver from the registery

func Open Uses

func Open(providerName, dsn string) (Provider, error)

Open initialize the specified provider and returns its instance

type ScanOpts Uses

type ScanOpts struct {
    Prefix        []byte
    Offset        []byte
    Scanner       Scanner
    IncludeOffset bool
    ReverseScan   bool

ScanOpts scanner options

type Scanner Uses

type Scanner func([]byte, []byte) bool

Scanner a function that performs the scanning/filterig



Package goukv imports 5 packages (graph) and is imported by 4 packages. Updated 2020-08-02. Refresh now. Tools for package owners.