Documentation
¶
Index ¶
- Variables
- type FindOption
- func WithDepth(d int) FindOption
- func WithExactLabels() FindOption
- func WithID(id string) FindOption
- func WithKey(key string) FindOption
- func WithLabelFormat(label string) FindOption
- func WithLabels(labels map[string]string) FindOption
- func WithLimit(l int64) FindOption
- func WithOffset(os int64) FindOption
- func WithOutLabelField() FindOption
- func WithStatus(status string) FindOption
- func WithTimeout(d time.Duration) FindOption
- type FindOptions
- type History
- type Init
- type KV
- type Revision
- type Track
- type View
Constants ¶
This section is empty.
Variables ¶
View Source
var ( KVService KV HistoryService History TrackService Track RevisionService Revision DBInit Init )
services
View Source
var ( ErrKeyNotExists = errors.New("can not find any key value") ErrRecordNotExists = errors.New("can not find any polling data") ErrRevisionNotExist = errors.New("revision does not exist") ErrAliasNotGiven = errors.New("label alias not given") )
db errors
Functions ¶
This section is empty.
Types ¶
type FindOption ¶
type FindOption func(*FindOptions)
FindOption is functional option to find key value
func WithDepth ¶
func WithDepth(d int) FindOption
WithDepth if you use greedy match this can specify the match depth
func WithExactLabels ¶
func WithExactLabels() FindOption
WithExactLabels tell model service to return only one kv matches the labels
func WithLabelFormat ¶
func WithLabelFormat(label string) FindOption
WithLabelFormat find kv by label string
func WithOutLabelField ¶
func WithOutLabelField() FindOption
WithOutLabelField will clear all labels attributes in kv doc
func WithTimeout ¶
func WithTimeout(d time.Duration) FindOption
WithTimeout will return err if execution take too long
type FindOptions ¶
type FindOptions struct {
ExactLabels bool
Status string
Depth int
ID string
Key string
Labels map[string]string
LabelFormat string
ClearLabel bool
Timeout time.Duration
Offset int64
Limit int64
}
FindOptions is option to find key value
func NewDefaultFindOpts ¶
func NewDefaultFindOpts() FindOptions
NewDefaultFindOpts return default options
type History ¶
type History interface {
GetHistory(ctx context.Context, keyID string, options ...FindOption) (*model.KVResponse, error)
}
History provide api of History entity
type KV ¶
type KV interface {
//below 3 methods is usually for admin console
Create(ctx context.Context, kv *model.KVDoc) (*model.KVDoc, error)
Update(ctx context.Context, kv *model.UpdateKVRequest) (*model.KVDoc, error)
List(ctx context.Context, domain, project string, options ...FindOption) (*model.KVResponse, error)
//FindOneAndDelete deletes one kv by id and return the deleted kv as these appeared before deletion
FindOneAndDelete(ctx context.Context, kvID string, domain, project string) (*model.KVDoc, error)
//FindManyAndDelete deletes multiple kvs and return the deleted kv list as these appeared before deletion
FindManyAndDelete(ctx context.Context, kvIDs []string, domain, project string) ([]*model.KVDoc, error)
//Get return kv by id
Get(ctx context.Context, request *model.GetKVRequest) (*model.KVDoc, error)
//KV is a resource of kie, this api should return kv resource number by domain id
Total(ctx context.Context, domain string) (int64, error)
}
KV provide api of KV entity
type Track ¶
type Track interface {
CreateOrUpdate(ctx context.Context, detail *model.PollingDetail) (*model.PollingDetail, error)
GetPollingDetail(ctx context.Context, detail *model.PollingDetail) ([]*model.PollingDetail, error)
}
History provide api of History entity
type View ¶
type View interface {
Create(ctx context.Context, viewDoc *model.ViewDoc, options ...FindOption) error
Update(ctx context.Context, viewDoc *model.ViewDoc) error
//TODO
List(ctx context.Context, domain, project string, options ...FindOption) ([]*model.ViewDoc, error)
GetCriteria(ctx context.Context, viewName, domain, project string) (map[string]map[string]string, error)
GetContent(ctx context.Context, id, domain, project string, options ...FindOption) ([]*model.KVResponse, error)
}
View create update and get view data
Click to show internal directories.
Click to hide internal directories.