flappingrule

package
v0.0.0-...-7ff62be Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 16, 2024 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	DBExport(c *gin.Context)
	common.CrudAPI
}

func NewApi

func NewApi(
	store Store,
	mongoExporter dbexport.Exporter,
	transformer common.PatternFieldsTransformer,
) 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 CreateRequest

type CreateRequest struct {
	EditRequest
	ID string `json:"_id" binding:"id"`
}

type EditRequest

type EditRequest struct {
	Name        string                    `json:"name" binding:"required,max=255"`
	Description string                    `json:"description" binding:"max=255"`
	FreqLimit   int                       `json:"freq_limit" binding:"required,gt=0"`
	Duration    datetime.DurationWithUnit `json:"duration" binding:"required"`
	Priority    int64                     `json:"priority" binding:"min=0"`
	Author      string                    `json:"author" swaggerignore:"true"`

	common.AlarmPatternFieldsRequest
	common.EntityPatternFieldsRequest
}

type FilteredQuery

type FilteredQuery struct {
	pagination.FilteredQuery
	SortBy string `` /* 141-byte string literal not displayed */
}

type Response

type Response struct {
	ID          string                    `bson:"_id" json:"_id"`
	Name        string                    `bson:"name" json:"name"`
	Description string                    `bson:"description" json:"description"`
	FreqLimit   int                       `bson:"freq_limit" json:"freq_limit"`
	Duration    datetime.DurationWithUnit `bson:"duration" json:"duration"`
	Priority    int64                     `bson:"priority" json:"priority"`
	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"`

	savedpattern.EntityPatternFields `bson:",inline"`
	savedpattern.AlarmPatternFields  `bson:",inline"`
}

type Store

type Store interface {
	Insert(ctx context.Context, r CreateRequest) (*Response, error)
	GetByID(ctx context.Context, id string) (*Response, error)
	Find(ctx context.Context, query FilteredQuery) (*AggregationResult, error)
	Update(ctx context.Context, r UpdateRequest) (*Response, error)
	Delete(ctx context.Context, id, userID string) (bool, error)
}

func NewStore

func NewStore(
	dbClient mongo.DbClient,
	authorProvider author.Provider,
) Store

type UpdateRequest

type UpdateRequest struct {
	EditRequest
	ID string `json:"-"`
}

type Validator

type Validator struct {
}

func NewValidator

func NewValidator() *Validator

func (*Validator) ValidateCreateRequest

func (v *Validator) ValidateCreateRequest(sl validator.StructLevel)

func (*Validator) ValidateUpdateRequest

func (v *Validator) ValidateUpdateRequest(sl validator.StructLevel)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL