Documentation
¶
Index ¶
Constants ¶
View Source
const ( LangZhCN = "zh-CN" //简体中文 LangEN = "en" //简体中文 LangJA = "en" //简体中文 LangDE = "de" //简体中文 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AsyncTask ¶
type AsyncTask[T any] struct { // contains filtered or unexported fields }
func (*AsyncTask[T]) NewWorkers ¶
type Broker ¶
type Cache ¶
type Cache interface {
//Set save the data to the cache
Set(ctx context.Context, key string, value interface{}, expire time.Duration) error
//SetNX save the data to the cache if not exist
SetNX(ctx context.Context, key string, value interface{}, expire time.Duration) error
//SetHash save the data to hash cache
SetHash(ctx context.Context, key, field string, value interface{}) error
//UpdateExpire update the data expire time
UpdateExpire(ctx context.Context, key string, expire time.Duration) error
//Get get data from cache
Get(ctx context.Context, key string, value interface{}) error
MGet(ctx context.Context, keys []string, value interface{}) error
//GetHash get the data to hash cache
GetHash(ctx context.Context, key, field string, value interface{}) error
//Keys get the keys match pattern
Keys(ctx context.Context, pattern string) ([]string, error)
//Exist Judge whether the key is existed
Exist(ctx context.Context, key string) (bool, error)
//SetAdd save unsorted list data to the cache
SetAdd(ctx context.Context, key string, member interface{}) error
//IsSetMember Judge whether the element is existed in the unsorted set
IsSetMember(ctx context.Context, key string, member interface{}) (bool, error)
//DelSetMember delete the member form the unsorted list
DelSetMember(ctx context.Context, key string, member ...interface{}) error
//SetList save sorted list data to the cache
SetList(ctx context.Context, key string, value interface{}) error
//GetList get sorted list data from the cache
GetList(ctx context.Context, key string, value interface{}) error
//Delete delete cache
Delete(ctx context.Context, key ...string) error
//Name cache name
Name() string
}
Cache represents interface of data cache
type DLock ¶
type I18nTranslator ¶
type I18nTranslator interface {
//Add add translation to i18n server
Add(ctx context.Context, lang, key, trans string) error
//Delete delete translation from i18n server
Delete(ctx context.Context, lang, key string) error
//Update update translation from i18n server
Update(ctx context.Context, lang, key, trans string) error
//TranslateKey translate key to language lang
TranslateKey(ctx context.Context, lang, key string) string
//Translate translate object i to language lang
Translate(ctx context.Context, lang string, i interface{})
}
type Publisher ¶
type Publisher interface {
Product(ctx context.Context, topic string, message interface{}, messageExpiration time.Duration) error //Product 生产者模型,pub message,qos: Transient (0 or 1) or Persistent (2)
Publish(ctx context.Context, topic string, message interface{}, messageExpiration time.Duration) error //广播模式
}
type RpcPublisher ¶
type RpcSubscriber ¶
Source Files
¶
- asnyc_task.go
- cache.go
- i18n.go
- locker.go
- mq.go
Click to show internal directories.
Click to hide internal directories.