dao

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventFunc

type EventFunc func(event *clientv3.Event) error

type Option

type Option func(opts *Options)

func WithHost

func WithHost(ip string) Option

func WithPassword

func WithPassword(pwd string) Option

func WithPort

func WithPort(port string) Option

func WithTimeout

func WithTimeout(timeout time.Duration) Option

func WithUsername

func WithUsername(username string) Option

type Options

type Options struct {
	Host     string
	Port     string
	Timeout  time.Duration
	Username string
	Password string
}

type Store

type Store interface {
	Init(ctx context.Context, option ...Option) (err error)
	Get(key string) (resp *clientv3.GetResponse, err error)
	GetAll(prefix string) (resp *clientv3.GetResponse, err error)
	Count(prefix string) (resp *clientv3.GetResponse, err error)
	Put(key, val string) (resp *clientv3.PutResponse, err error)
	PutWithLease(key, val string, id clientv3.LeaseID) (resp *clientv3.PutResponse, err error)
	Del(key string) (resp *clientv3.DeleteResponse, err error)
	DelWithLease(key string, leaseId int64) (resp *clientv3.DeleteResponse, err error)
	KeepOnce(key string, leaseId int64) (resp *clientv3.LeaseKeepAliveResponse, err error)
	KeepAlive(key, val string) (err error)
	Watch(key string, putFunc EventFunc, delFunc EventFunc)
	Lease(key string, ttl int64) (resp *clientv3.LeaseGrantResponse, err error)
}

func NewStore

func NewStore() Store

Jump to

Keyboard shortcuts

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