Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateCreateRequest ¶
func ValidateCreateRequest(sl validator.StructLevel)
func ValidateUpdateRequest ¶
func ValidateUpdateRequest(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 CreateRequest ¶
type CreateRequest struct { Value string `json:"value" binding:"required,max=255"` Color string `json:"color" binding:"required,iscolor"` Author string `json:"author" swaggerignore:"true"` common.AlarmPatternFieldsRequest common.EntityPatternFieldsRequest }
type ListRequest ¶
type ListRequest struct { pagination.FilteredQuery SortBy string `form:"sort_by" json:"sort_by" binding:"oneoforempty=value created"` Values []string `form:"values[]" json:"values"` }
type Response ¶
type Response struct { ID string `bson:"_id" json:"_id"` Type int64 `bson:"type" json:"type"` Value string `bson:"value" json:"value"` Color string `bson:"color" json:"color"` Author *author.Author `bson:"author" json:"author"` Updated datetime.CpsTime `bson:"updated" json:"updated" swaggertype:"integer"` Created datetime.CpsTime `bson:"created" json:"created" swaggertype:"integer"` Deletable *bool `bson:"deletable,omitempty" json:"deletable,omitempty"` savedpattern.EntityPatternFields `bson:",inline"` savedpattern.AlarmPatternFields `bson:",inline"` }
type Store ¶
type Store interface { Find(ctx context.Context, r ListRequest) (*AggregationResult, error) GetByID(ctx context.Context, id string) (*Response, error) Create(ctx context.Context, r CreateRequest) (*Response, error) Update(ctx context.Context, r UpdateRequest) (*Response, error) Delete(ctx context.Context, id, userID string) (bool, error) }
type UpdateRequest ¶
type UpdateRequest struct { ID string `json:"-"` Color string `json:"color" binding:"required,iscolor"` Author string `json:"author" swaggerignore:"true"` common.AlarmPatternFieldsRequest common.EntityPatternFieldsRequest }
Click to show internal directories.
Click to hide internal directories.