Documentation ¶
Index ¶
- Variables
- func GetNestedAuthorPipeline() []bson.M
- func GetNestedExdatesPipeline() []bson.M
- func GetNestedObjectsPipeline() []bson.M
- func GetNestedReasonPipeline() []bson.M
- func GetNestedTypePipeline() []bson.M
- type API
- type AggregationEIDsResult
- type AggregationResult
- type CountFilterResult
- type CreateRequest
- type EID
- type EIDsListRequest
- type EditRequest
- type Filter
- type FilterRequest
- type FindByEntityIDRequest
- type ListRequest
- type ModelTransformer
- type MongoQuery
- type PBehavior
- type Store
- type UpdateRequest
- type Validator
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrExceptionNotExists = errors.New("exception doesn't exist")
View Source
var ErrReasonNotExists = errors.New("reason doesn't exist")
Functions ¶
func GetNestedAuthorPipeline ¶
func GetNestedReasonPipeline ¶
func GetNestedTypePipeline ¶
Types ¶
type API ¶
type API interface { common.CrudAPI ListByEntityID(c *gin.Context) GetEIDs(c *gin.Context) CountFilter(c *gin.Context) }
func NewApi ¶
func NewApi( transformer ModelTransformer, store Store, computeChan chan<- pbehavior.ComputeTask, conf config.UserInterfaceConfigProvider, actionLogger logger.ActionLogger, logger zerolog.Logger, ) API
type AggregationEIDsResult ¶
type AggregationEIDsResult struct { Data []EID `bson:"data" json:"data"` TotalCount int64 `bson:"total_count" json:"total_count"` }
func (*AggregationEIDsResult) GetData ¶
func (r *AggregationEIDsResult) GetData() interface{}
func (*AggregationEIDsResult) GetTotal ¶
func (r *AggregationEIDsResult) GetTotal() int64
type AggregationResult ¶
type AggregationResult struct { Data []PBehavior `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 CountFilterResult ¶
type CountFilterResult struct { OverLimit bool `bson:"-" json:"over_limit"` TotalCount int64 `bson:"total_count" json:"total_count"` }
func (*CountFilterResult) GetTotal ¶
func (r *CountFilterResult) GetTotal() int64
type CreateRequest ¶
type CreateRequest struct { EditRequest ID string `json:"_id" binding:"id"` }
type EIDsListRequest ¶
type EIDsListRequest struct { pagination.FilteredQuery SortBy string `form:"sort_by" json:"sort_by" binding:"oneoforempty=id"` }
type EditRequest ¶
type EditRequest struct { Author string `json:"author" swaggerignore:"true"` Enabled *bool `json:"enabled" binding:"required"` Filter interface{} `json:"filter" binding:"required"` Name string `json:"name" binding:"required,max=255"` Reason string `json:"reason" binding:"required"` RRule string `json:"rrule"` Start types.CpsTime `json:"tstart" binding:"required" swaggertype:"integer"` Stop *types.CpsTime `json:"tstop" swaggertype:"integer"` Type string `json:"type" binding:"required"` Exdates []pbehaviorexception.ExdateRequest `json:"exdates" binding:"dive"` Exceptions []string `json:"exceptions"` }
type Filter ¶
type Filter struct {
// contains filtered or unexported fields
}
func (Filter) MarshalJSON ¶
type FilterRequest ¶
type FilterRequest struct {
Filter interface{} `json:"filter" binding:"required"`
}
type FindByEntityIDRequest ¶
type FindByEntityIDRequest struct {
ID string `form:"id" binding:"required"`
}
type ListRequest ¶
type ListRequest struct { pagination.FilteredQuery SortBy string `` /* 144-byte string literal not displayed */ }
type ModelTransformer ¶
type ModelTransformer interface { TransformCreateRequestToModel(request CreateRequest) (*PBehavior, error) TransformUpdateRequestToModel(request UpdateRequest) (*PBehavior, error) }
func NewModelTransformer ¶
func NewModelTransformer( dbClient mongo.DbClient, reasonTransformer apireason.ModelTransformer, exceptionTransformer pbehaviorexception.ModelTransformer, ) ModelTransformer
type MongoQuery ¶
type MongoQuery struct {
// contains filtered or unexported fields
}
func CreateMongoQuery ¶
func CreateMongoQuery(client mongo.DbClient) MongoQuery
func (*MongoQuery) CreateAggregationPipeline ¶
func (q *MongoQuery) CreateAggregationPipeline(ctx context.Context, r ListRequest) ([]bson.M, error)
type PBehavior ¶
type PBehavior struct { ID string `bson:"_id" json:"_id"` Author string `bson:"author" json:"author"` Comments pbehavior.Comments `bson:"comments" json:"comments"` Enabled bool `bson:"enabled" json:"enabled"` Filter Filter `bson:"filter" json:"filter"` Name string `bson:"name" json:"name"` Reason *pbehaviorreason.Reason `bson:"reason" json:"reason"` RRule string `bson:"rrule" json:"rrule"` Start *types.CpsTime `bson:"tstart" json:"tstart" swaggertype:"integer"` Stop *types.CpsTime `bson:"tstop" json:"tstop" swaggertype:"integer"` Created *types.CpsTime `bson:"created" json:"created" swaggertype:"integer"` Updated *types.CpsTime `bson:"updated" json:"updated" swaggertype:"integer"` Type *pbehavior.Type `bson:"type" json:"type"` Exdates []pbehaviorexception.Exdate `bson:"exdates" json:"exdates"` Exceptions []pbehaviorexception.Exception `bson:"exceptions" json:"exceptions"` // IsActiveStatus represents if pbehavior is in action for current time. IsActiveStatus *bool `bson:"-" json:"is_active_status,omitempty"` }
type Store ¶
type Store interface { Insert(ctx context.Context, model *PBehavior) error Find(ctx context.Context, r ListRequest) (*AggregationResult, error) FindByEntityID(ctx context.Context, entityID string) ([]PBehavior, error) GetOneBy(ctx context.Context, filter bson.M) (*PBehavior, error) GetEIDs(ctx context.Context, pbhID string, request EIDsListRequest) (AggregationEIDsResult, error) Update(ctx context.Context, model *PBehavior) (bool, error) Delete(ctx context.Context, id string) (bool, error) Count(context.Context, Filter, int) (*CountFilterResult, error) }
type UpdateRequest ¶
type UpdateRequest struct { EditRequest ID string `json:"-"` }
Click to show internal directories.
Click to hide internal directories.