dao

package
v0.0.0-...-298ae05 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Md5Hex

func Md5Hex(byt []byte, salt []byte) string

func Sha256Hex

func Sha256Hex(byt []byte, salt []byte) string

Types

type EventFunc

type EventFunc func(event *clientv3.Event) error

type Option

type Option func(opts *Options)

func WithAddr

func WithAddr(addr string) Option

func WithPassword

func WithPassword(pwd string) Option

func WithTimeout

func WithTimeout(timeout time.Duration) Option

func WithUsername

func WithUsername(username string) Option

type Options

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

type Store

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

func NewStore

func NewStore() Store

Jump to

Keyboard shortcuts

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