Documentation ¶
Index ¶
- Variables
- func CopyMap(s operator.M) (r operator.M)
- func FormatTime(data []operator.M, needTimeFormatList []string)
- func GetCustomCondition(req *restful.Request) *operator.Condition
- func GetQueryParamInt(req *restful.Request, key string, defaultValue int) (int, error)
- func GetQueryParamInt64(req *restful.Request, key string, defaultValue int64) (int64, error)
- func GetQueryParamString(req *restful.Request, key string) string
- func GetQueryParamStringArray(req *restful.Request, key, sep string) []string
- func MarkProcess(f restful.RouteFunction) restful.RouteFunction
- func ReportQueuePushMetrics(name string, err error, started time.Time)
- func ReturnRest(resp *RestResponse)
- type Event
- type EventType
- type ExtraField
- type Manager
- type RestResponse
- type Selector
- type Store
- func (a *Store) Count(ctx context.Context, resourceType string, opt *StoreGetOption) (int64, error)
- func (a *Store) CreateIndex(ctx context.Context, resourceType string, index drivers.Index) error
- func (a *Store) DeleteIndex(ctx context.Context, resourceType string, indexName string) error
- func (a *Store) Get(ctx context.Context, resourceType string, opt *StoreGetOption) ([]operator.M, error)
- func (a *Store) GetDB() drivers.DB
- func (a *Store) GetIndex(ctx context.Context, resourceType string) (*drivers.Index, error)
- func (a *Store) Put(ctx context.Context, resourceType string, data operator.M, opt *StorePutOption) error
- func (a *Store) Remove(ctx context.Context, resourceType string, opt *StoreRemoveOption) error
- func (a *Store) SetSoftDeletion(flag bool)
- func (a *Store) Watch(ctx context.Context, resourceType string, opt *StoreWatchOption) (chan *Event, error)
- type StoreGetOption
- type StorePutOption
- type StoreRemoveOption
- type StoreWatchOption
- type WatchServer
- type WatchServerOption
Constants ¶
This section is empty.
Variables ¶
var ( // EventWatchBreak watch break event EventWatchBreak = &Event{Type: Brk, Value: nil} // EventWatchBreakBytes watch break event content EventWatchBreakBytes, _ = json.Marshal(EventWatchBreak) )
Functions ¶
func FormatTime ¶
FormatTime format time
func GetCustomCondition ¶ added in v0.20.15
GetCustomCondition get custom condition from req url and parameter
func GetQueryParamInt ¶
GetQueryParamInt get int from restful query parameter
func GetQueryParamInt64 ¶
GetQueryParamInt64 get int64 from restful query parameter
func GetQueryParamString ¶
GetQueryParamString get string from rest query parameter
func GetQueryParamStringArray ¶
GetQueryParamStringArray get string array from restful query parameter
func MarkProcess ¶
func MarkProcess(f restful.RouteFunction) restful.RouteFunction
MarkProcess does the following things: 1. print log when a request comes in and returns. 2. print request body to log. 3. flow control.
func ReportQueuePushMetrics ¶ added in v0.20.3
ReportQueuePushMetrics report all queue push metrics
Types ¶
type ExtraField ¶
type ExtraField struct {
// contains filtered or unexported fields
}
ExtraField extra field
func (*ExtraField) Unmarshal ¶
func (ef *ExtraField) Unmarshal(r interface{}) (err error)
Unmarshal unmarshal extra field to struct
type RestResponse ¶
type RestResponse struct { Resp *restful.Response HTTPCode int Data interface{} ErrCode int Message string Extra map[string]interface{} WrapFunc func([]byte) []byte }
RestResponse wrapper for restful Response
type Selector ¶ added in v0.20.15
func (*Selector) Clear ¶ added in v0.20.15
func (s *Selector) Clear()
Clear reset the current cursor for labelSelector condition parsing
func (*Selector) GetAllConditions ¶ added in v0.20.15
GetAllConditions get all conditions of labelSelector
func (*Selector) GetNextCondition ¶ added in v0.20.15
TODO: error operation GetNextCondition get next label selector condition unit
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store action for rest request
func (*Store) CreateIndex ¶ added in v0.20.15
CreateIndex create single index for table
func (*Store) DeleteIndex ¶ added in v0.20.15
DeleteIndex delete single index for table
func (*Store) Get ¶
func (a *Store) Get(ctx context.Context, resourceType string, opt *StoreGetOption) ([]operator.M, error)
Get get something from db according to request
func (*Store) Put ¶
func (a *Store) Put(ctx context.Context, resourceType string, data operator.M, opt *StorePutOption) error
Put put something into db according to request
func (*Store) SetSoftDeletion ¶ added in v0.20.14
SetSoftDeletion set store to do soft delet
type StoreGetOption ¶
type StoreGetOption struct { Fields []string Sort map[string]int Cond *operator.Condition Offset int64 Limit int64 IsAllDocuments bool }
StoreGetOption option for get action
type StorePutOption ¶
type StorePutOption struct { UniqueKey []string Cond *operator.Condition CreateTimeKey string UpdateTimeKey string }
StorePutOption option for put action
type StoreRemoveOption ¶
type StoreRemoveOption struct { Cond *operator.Condition // IgnoreNotFound if return err when data not found IgnoreNotFound bool }
StoreRemoveOption option for remove action
type StoreWatchOption ¶
type StoreWatchOption struct { Cond operator.M SelfOnly bool MaxEvents uint Timeout time.Duration MustDiff string }
StoreWatchOption option for watch action
type WatchServer ¶
type WatchServer struct { Writer func(resp *restful.Response, event *Event) bool // contains filtered or unexported fields }
WatchServer the server side handler in a watch action.
func NewWatchServer ¶
func NewWatchServer(wopt *WatchServerOption) (*WatchServer, error)
NewWatchServer create default json formate watchServer