Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateEditRequest ¶
func ValidateEditRequest(sl validator.StructLevel)
Types ¶
type API ¶
type AggregationResult ¶
type AggregationResult struct { Data []Response `bson:"data" json:"data"` TotalCount int64 `bson:"total_count" json:"total_count"` }
func (*AggregationResult) GetData ¶
func (r *AggregationResult) GetData() interface{}
func (*AggregationResult) GetTotal ¶
func (r *AggregationResult) GetTotal() int64
type BulkDeleteRequestItem ¶
type BulkDeleteRequestItem struct {
ID string `json:"_id" binding:"required"`
}
type Count ¶
type CountAlarmsResponse ¶
type CountEntitiesResponse ¶
type CountRequest ¶
type EditRequest ¶
type EditRequest struct { ID string `json:"-"` Title string `json:"title" binding:"required,max=255"` Type string `json:"type" binding:"required,oneof=alarm entity pbehavior weather_service"` IsCorporate *bool `json:"is_corporate" binding:"required"` AlarmPattern pattern.Alarm `json:"alarm_pattern" binding:"alarm_pattern"` EntityPattern pattern.Entity `json:"entity_pattern" binding:"entity_pattern"` PbehaviorPattern pattern.PbehaviorInfo `json:"pbehavior_pattern" binding:"pbehavior_pattern"` WeatherServicePattern pattern.WeatherServicePattern `json:"weather_service_pattern" binding:"weather_service_pattern"` Author string `json:"author" swaggerignore:"true"` }
type ListRequest ¶
type ListRequest struct { pagination.FilteredQuery SortBy string `json:"sort_by" form:"sort_by" binding:"oneoforempty=_id title author.name author.display_name created updated"` Corporate *bool `json:"corporate" form:"corporate"` Type string `json:"type" form:"type"` }
type Response ¶
type Response struct { ID string `bson:"_id" json:"_id"` Title string `bson:"title" json:"title"` Type string `bson:"type" json:"type"` IsCorporate bool `bson:"is_corporate" json:"is_corporate"` AlarmPattern pattern.Alarm `bson:"alarm_pattern" json:"alarm_pattern,omitempty"` EntityPattern pattern.Entity `bson:"entity_pattern" json:"entity_pattern,omitempty"` PbehaviorPattern pattern.PbehaviorInfo `bson:"pbehavior_pattern" json:"pbehavior_pattern,omitempty"` WeatherServicePattern pattern.WeatherServicePattern `bson:"weather_service_pattern" json:"weather_service_pattern,omitempty"` Author *author.Author `bson:"author" json:"author"` Created datetime.CpsTime `bson:"created,omitempty" json:"created,omitempty" swaggertype:"integer"` Updated datetime.CpsTime `bson:"updated,omitempty" json:"updated,omitempty" swaggertype:"integer"` }
type Store ¶
type Store interface { Insert(ctx context.Context, r EditRequest) (*Response, error) GetByID(ctx context.Context, id, userID string) (*Response, error) Find(ctx context.Context, r ListRequest, userID string) (*AggregationResult, error) Update(ctx context.Context, r EditRequest) (*Response, error) Delete(ctx context.Context, pattern Response, userID string) (bool, error) CountAlarms(ctx context.Context, r CountRequest, maxCount int64) (CountAlarmsResponse, error) CountEntities(ctx context.Context, r CountRequest, maxCount int64) (CountEntitiesResponse, error) }
func NewStore ¶
func NewStore( dbClient mongo.DbClient, pbhComputeChan chan<- rpc.PbehaviorRecomputeEvent, serviceChangeListener chan<- entityservice.ChangeEntityMessage, authorProvider author.Provider, logger zerolog.Logger, ) Store
Click to show internal directories.
Click to hide internal directories.