nustdbclient

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConnTimeout = time.Second * 3
	OperTimeout = time.Second * 5
)

Variables

This section is empty.

Functions

This section is empty.

Types

type TNustDBClient

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

func GetInstance

func GetInstance(bucket_name, db_path string) *TNustDBClient

*

  • 获取一个单例,可以用这个不需要考虑线程安全

func GetSafeInstance

func GetSafeInstance(bucket_name, db_path string) *TNustDBClient

*

  • 获取一个线程安全的单例

func InitInstance

func InitInstance(bucket_name, db_path string) *TNustDBClient

*

  • 初始化一个单例,一般用于程序启动时

func (*TNustDBClient) Del

func (s *TNustDBClient) Del(keyname string) error

*

  • Delete One

func (*TNustDBClient) DelAll

func (s *TNustDBClient) DelAll(keyname string) error

func (*TNustDBClient) Get

func (s *TNustDBClient) Get(keyname string) (value string, err error)

*

  • Get Single Key

func (*TNustDBClient) GetAll

func (s *TNustDBClient) GetAll(keyname string) (items []*TNustDBField, err error)

func (*TNustDBClient) GetHead

func (d *TNustDBClient) GetHead() string

*

  • 连接etcd

func (*TNustDBClient) Set

func (s *TNustDBClient) Set(keyname string, value string, args ...int) error

*

  • Set Value ttl : NusDB支持TTL(存活时间)的功能,可以对指定的bucket里的key过期时间的设置

func (*TNustDBClient) SetHead

func (d *TNustDBClient) SetHead(head string)

type TNustDBField

type TNustDBField struct {
	Key   string
	Value string
}

Jump to

Keyboard shortcuts

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