domain

package
v0.0.0-...-eecab09 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Filter

type Filter struct {
	FilterField string      `json:"filter_field" form:"filter_field" validate:"required,ne="`
	Operator    string      `json:"operate" form:"operator" validate:"required,oneof=== != > >= < <= in not-in like between"`
	Value       interface{} `json:"value" form:"value" validate:"required"`
}

Filter -.

type ICRUDRepository

type ICRUDRepository interface {
	GetByID(ctx context.Context, e IEntity) (IEntity, error)
	GetAll(ctx context.Context, sq *SearchQuery, e IEntity) (*List, error)
	Create(ctx context.Context, e IEntity) (IEntity, error)
	Update(ctx context.Context, e IEntity) (IEntity, error)
	UpdateWithFields(ctx context.Context, e IEntity, keys []string) (IEntity, error)
	Delete(ctx context.Context, e IEntity) (IEntity, error)

	CreateTx(context.Context, IEntity, ITransactionEvent) (IEntity, error)
	UpdateTx(context.Context, IEntity, ITransactionEvent) (IEntity, error)
	UpdateWithFieldsTx(context.Context, IEntity, []string, ITransactionEvent) (IEntity, error)
	DeleteTx(context.Context, IEntity, ITransactionEvent) (IEntity, error)
}

type ICacheUpdateRepository

type ICacheUpdateRepository interface {
	Save(ctx context.Context, e IEntity) error
	Delete(ctx context.Context, e IEntity) error
}

type IEntity

type IEntity interface {
	GetID() string
	SetID(string)
}

type ITransactionEvent

type ITransactionEvent interface {
	GetTx() interface{}
}

type ITransactionRepo

type ITransactionRepo interface {
	RunTransaction(ctx context.Context, f TransactionEventFunc) error
}

type List

type List struct {
	Limit  int64     `json:"limit"`
	Offset int64     `json:"offset"`
	Total  int64     `json:"total"`
	Data   []IEntity `json:"data"`
}

type Order

type Order struct {
	OrderField string `json:"order_field" form:"order_field" validate:"required,ne="`
	Dir        string `json:"dir" form:"dir" validate:"omitempty,oneof=asc desc"`
}

Sort -.

type Page

type Page struct {
	Limit  int `json:"limit" form:"limit" validate:"min=1,max=1000"`
	Offset int `json:"offset" form:"offset" validate:"min=0"`
}

type SearchQuery

type SearchQuery struct {
	Page    Page     `json:"page" binding:"required" form:"page" validate:"required"`
	Filters []Filter `json:"filters" form:"filters"`
	Orders  []Order  `json:"orders" form:"orders"`
}

func (*SearchQuery) GetArgs

func (sq *SearchQuery) GetArgs() []interface{}

func (*SearchQuery) GetKey

func (sq *SearchQuery) GetKey() string

func (*SearchQuery) GetOrder

func (sq *SearchQuery) GetOrder() string

func (*SearchQuery) GetWhere

func (sq *SearchQuery) GetWhere() string

type TransactionEventFunc

type TransactionEventFunc func(context.Context, ITransactionEvent) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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