buntdb

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2021 License: AGPL-3.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

View Source
const MEMORYDB = ":memory:"

Variables

View Source
var (
	ErrKeyExist       = errors.New("key exist")
	ErrNotInitialized = errors.New("not initialized")
	ErrRollback       = errors.New("rollback")
)
View Source
var TxKey = new(struct{})

Functions

func BilibiliCurrentLiveKey

func BilibiliCurrentLiveKey(keys ...interface{}) string

func BilibiliCurrentNewsKey

func BilibiliCurrentNewsKey(keys ...interface{}) string

func BilibiliDynamicIdKey

func BilibiliDynamicIdKey(keys ...interface{}) string

func BilibiliGroupAtAllMarkKey added in v0.0.10

func BilibiliGroupAtAllMarkKey(keys ...interface{}) string

func BilibiliGroupConcernConfigKey added in v0.0.10

func BilibiliGroupConcernConfigKey(keys ...interface{}) string

func BilibiliGroupConcernStateKey

func BilibiliGroupConcernStateKey(keys ...interface{}) string

func BilibiliNotLiveCountKey added in v0.0.7

func BilibiliNotLiveCountKey(keys ...interface{}) string

func BilibiliOriginMarkKey added in v0.1.3

func BilibiliOriginMarkKey(keys ...interface{}) string

func BilibiliUidFirstTimestampKey added in v0.0.6

func BilibiliUidFirstTimestampKey(keys ...interface{}) string

func BilibiliUserCookieInfoKey added in v0.0.17

func BilibiliUserCookieInfoKey(keys ...interface{}) string

func BilibiliUserInfoKey

func BilibiliUserInfoKey(keys ...interface{}) string

func BilibiliUserStatKey added in v0.0.19

func BilibiliUserStatKey(keys ...interface{}) string

func BilibiliVideoOriginMarkKey added in v0.0.20

func BilibiliVideoOriginMarkKey(keys ...interface{}) string

func BilibliFreshKey

func BilibliFreshKey(keys ...interface{}) string

func BlockListKey

func BlockListKey(keys ...interface{}) string

func Close

func Close() error

func CreatePatternIndex added in v0.1.4

func CreatePatternIndex(patternFunc KeyPatternFunc, suffix []interface{}, less ...func(a, b string) bool) error

func DouyuCurrentLiveKey

func DouyuCurrentLiveKey(keys ...interface{}) string

func DouyuFreshKey

func DouyuFreshKey(keys ...interface{}) string

func DouyuGroupAtAllMarkKey added in v0.0.10

func DouyuGroupAtAllMarkKey(keys ...interface{}) string

func DouyuGroupConcernConfigKey added in v0.0.10

func DouyuGroupConcernConfigKey(keys ...interface{}) string

func DouyuGroupConcernStateKey

func DouyuGroupConcernStateKey(keys ...interface{}) string

func ExpireOption

func ExpireOption(duration time.Duration) *buntdb.SetOptions

ExpireOption 是一个创建expire的函数糖

func GetClient

func GetClient() (*buntdb.DB, error)

func GetInt64 added in v0.1.4

func GetInt64(key string) (int64, error)

func GlobalEnabledKey added in v0.0.16

func GlobalEnabledKey(keys ...interface{}) string

func GlobalSilenceKey added in v0.1.3

func GlobalSilenceKey(keys ...interface{}) string

func GroupEnabledKey

func GroupEnabledKey(keys ...interface{}) string

func GroupInvitedKey added in v0.1.0

func GroupInvitedKey(keys ...interface{}) string

func GroupInvitorKey

func GroupInvitorKey(keys ...interface{}) string

func GroupMessageImageKey

func GroupMessageImageKey(keys ...interface{}) string

func GroupMuteKey

func GroupMuteKey(keys ...interface{}) string

func GroupPermissionKey

func GroupPermissionKey(keys ...interface{}) string

func GroupSilenceKey added in v0.1.3

func GroupSilenceKey(keys ...interface{}) string

func HuyaCurrentLiveKey added in v0.0.7

func HuyaCurrentLiveKey(keys ...interface{}) string

func HuyaFreshKey added in v0.0.7

func HuyaFreshKey(keys ...interface{}) string

func HuyaGroupAtAllMarkKey added in v0.0.10

func HuyaGroupAtAllMarkKey(keys ...interface{}) string

func HuyaGroupConcernConfigKey added in v0.0.10

func HuyaGroupConcernConfigKey(keys ...interface{}) string

func HuyaGroupConcernStateKey added in v0.0.7

func HuyaGroupConcernStateKey(keys ...interface{}) string

func ImageCacheKey

func ImageCacheKey(keys ...interface{}) string

func InitBuntDB

func InitBuntDB(dbpath string) error

func IsRollback added in v0.0.10

func IsRollback(e error) bool

func JsonGet added in v0.1.0

func JsonGet(key string, obj interface{}) error

func JsonSave added in v0.1.0

func JsonSave(key string, obj interface{}, opt ...*buntdb.SetOptions) error

func Key

func Key(keys ...interface{}) string

func LoliconPoolStoreKey

func LoliconPoolStoreKey(keys ...interface{}) string

func ModeKey added in v0.1.0

func ModeKey() string

func MustGetClient

func MustGetClient() *buntdb.DB

func NamedKey

func NamedKey(name string, keys []interface{}) string

func NewFriendRequestKey added in v0.1.0

func NewFriendRequestKey(keys ...interface{}) string

func ParseConcernStateKeyWithInt64 added in v0.0.7

func ParseConcernStateKeyWithInt64(key string) (groupCode int64, id int64, err error)

func ParseConcernStateKeyWithString added in v0.0.7

func ParseConcernStateKeyWithString(key string) (groupCode int64, id string, err error)

func PermissionKey

func PermissionKey(keys ...interface{}) string

func RCover added in v0.0.18

func RCover(f func() error) error

func RCoverTx added in v0.0.19

func RCoverTx(f func(tx *buntdb.Tx) error) error

func RWCover added in v0.1.0

func RWCover(f func() error) error

func RWCoverTx added in v0.0.19

func RWCoverTx(f func(tx *buntdb.Tx) error) error

func RemoveByPrefixAndIndex added in v0.0.19

func RemoveByPrefixAndIndex(prefixKey []string, indexKey []string) ([]string, error)

RemoveByPrefixAndIndex 遍历每个index,如果一个key满足任意prefix,则删掉

func SeqClear added in v0.1.2

func SeqClear(key string) error

func SeqNext added in v0.1.2

func SeqNext(key string) (int64, error)

func SetIfNotExist added in v0.1.4

func SetIfNotExist(key, value string, opt ...*buntdb.SetOptions) error

func SetInt64 added in v0.1.4

func SetInt64(key string, value int64, opt ...*buntdb.SetOptions) (int64, error)

func VersionKey added in v0.1.4

func VersionKey(keys ...interface{}) string

func YoutubeFreshKey

func YoutubeFreshKey(keys ...interface{}) string

func YoutubeGroupAtAllMarkKey added in v0.0.10

func YoutubeGroupAtAllMarkKey(keys ...interface{}) string

func YoutubeGroupConcernConfigKey added in v0.0.10

func YoutubeGroupConcernConfigKey(keys ...interface{}) string

func YoutubeGroupConcernStateKey

func YoutubeGroupConcernStateKey(keys ...interface{}) string

func YoutubeInfoKey

func YoutubeInfoKey(keys ...interface{}) string

func YoutubeUserInfoKey

func YoutubeUserInfoKey(keys ...interface{}) string

func YoutubeVideoKey

func YoutubeVideoKey(keys ...interface{}) string

Types

type KeyPatternFunc added in v0.1.0

type KeyPatternFunc func(...interface{}) string

type ShortCut

type ShortCut struct{}

func (*ShortCut) CreatePatternIndex added in v0.1.4

func (s *ShortCut) CreatePatternIndex(patternFunc KeyPatternFunc, suffix []interface{}, less ...func(a, b string) bool) error

func (*ShortCut) GetInt64 added in v0.1.4

func (s *ShortCut) GetInt64(key string) (int64, error)

func (*ShortCut) JsonGet added in v0.1.0

func (s *ShortCut) JsonGet(key string, obj interface{}) error

func (*ShortCut) JsonSave added in v0.1.0

func (s *ShortCut) JsonSave(key string, obj interface{}, opt ...*buntdb.SetOptions) error

func (*ShortCut) RCover added in v0.0.18

func (*ShortCut) RCover(f func() error) error

func (*ShortCut) RCoverTx added in v0.0.18

func (*ShortCut) RCoverTx(f func(tx *buntdb.Tx) error) error

func (*ShortCut) RWCover added in v0.1.0

func (*ShortCut) RWCover(f func() error) error

func (*ShortCut) RWCoverTx added in v0.0.18

func (*ShortCut) RWCoverTx(f func(tx *buntdb.Tx) error) error

RWCoverTx 在一个RW事务中执行f,注意f的返回值不一定是RWCoverTx的返回值 有可能f返回nil,但RWTxCover返回non-nil 可以忽略error,但不要简单地用f返回值替代RWTxCover返回值,ref: bilibili/MarkDynamicId

func (*ShortCut) SeqClear added in v0.1.2

func (s *ShortCut) SeqClear(key string) error

func (*ShortCut) SeqNext added in v0.1.2

func (s *ShortCut) SeqNext(key string) (int64, error)

func (*ShortCut) SetIfNotExist added in v0.1.4

func (s *ShortCut) SetIfNotExist(key, value string, opt ...*buntdb.SetOptions) error

SetIfNotExist 使用opt设置key value,如果key已经存在,则回滚并返回 ErrRollback

func (*ShortCut) SetInt64 added in v0.1.4

func (s *ShortCut) SetInt64(key string, value int64, opt ...*buntdb.SetOptions) (int64, error)

Jump to

Keyboard shortcuts

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