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

package goukv

import "github.com/alash3al/goukv"


Package Files

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 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(map[string]interface{}) (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 string, opts map[string]interface{}) (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 3 packages (graph) and is imported by 2 packages. Updated 2020-04-24. Refresh now. Tools for package owners.