Documentation
¶
Index ¶
- Constants
- Variables
- func ConcurrencyUpdate2Latest(ctx context.Context, adaptor RecordAdaptor, mu sync.Locker, ...) (err error)
- func Update2Latest(ctx context.Context, adaptor RecordAdaptor, functions ...*FuncInfo) (err error)
- type FN
- type FuncConfig
- type FuncInfo
- type KVDatabaseAdaptor
- type MysqlAdaptor
- type Record
- type RecordAdaptor
- type RecordQueryParams
- type RecordQueryResult
Constants ¶
View Source
const ( FuncTypeRaw = 0 FuncTypeSql = 1 )
View Source
const ( ExecStatusFailed = 0 ExecStatusSuccess = 1 )
Variables ¶
View Source
var (
ErrExecuteTimeout = errors.New("execute timeout")
)
Functions ¶
func ConcurrencyUpdate2Latest ¶
func ConcurrencyUpdate2Latest(ctx context.Context, adaptor RecordAdaptor, mu sync.Locker, functions ...*FuncInfo) (err error)
ConcurrencyUpdate2Latest use distributed lock to update latest. see kvdb.NewMutex, if you use sync.Locker locally, it may cause consistency problems in distributed environment.
func Update2Latest ¶
func Update2Latest(ctx context.Context, adaptor RecordAdaptor, functions ...*FuncInfo) (err error)
Types ¶
type FuncConfig ¶
type FuncConfig struct {
// contains filtered or unexported fields
}
FuncConfig function config
func NewFuncConfig ¶
func NewFuncConfig() *FuncConfig
func (*FuncConfig) Must ¶
func (c *FuncConfig) Must(b ...bool) *FuncConfig
func (*FuncConfig) Retry ¶
func (c *FuncConfig) Retry(b ...bool) *FuncConfig
func (*FuncConfig) Timeout ¶
func (c *FuncConfig) Timeout(d time.Duration) *FuncConfig
type FuncInfo ¶
type FuncInfo struct {
FuncConfig
Name string
Type int
FN FN
}
FuncInfo ...
func NewFunc ¶
func NewFunc(name string, fn FN, cfg *FuncConfig, typ ...int) *FuncInfo
NewFunc constructor
type KVDatabaseAdaptor ¶
type KVDatabaseAdaptor struct {
// contains filtered or unexported fields
}
func (KVDatabaseAdaptor) Load ¶
func (k KVDatabaseAdaptor) Load(ctx context.Context, params *RecordQueryParams) (res *RecordQueryResult, err error)
type MysqlAdaptor ¶
type MysqlAdaptor struct {
// contains filtered or unexported fields
}
func NewMysqlAdaptor ¶
func (*MysqlAdaptor) Load ¶
func (m *MysqlAdaptor) Load(ctx context.Context, params *RecordQueryParams) (res *RecordQueryResult, err error)
type RecordAdaptor ¶
type RecordAdaptor interface {
Store(ctx context.Context, record *Record) (err error)
Load(ctx context.Context, params *RecordQueryParams) (res *RecordQueryResult, err error)
}
func NewKVDatabaseAdaptor ¶
func NewKVDatabaseAdaptor(db ...kvdb.Database) (a RecordAdaptor)
type RecordQueryParams ¶
type RecordQueryResult ¶
Click to show internal directories.
Click to hide internal directories.