actions

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: May 28, 2023 License: MIT Imports: 23 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BsonMTransferModel

func BsonMTransferModel(bm bson.M, model any) (err error)

Types

type Base

type Base struct {
	ModelMgm  mgm.Model
	ModelGorm schema.Tabler
}

func (*Base) Handler

func (*Base) Handler() gin.HandlerFunc

Handler action handler

func (*Base) String

func (*Base) String() string

type Control

type Control struct {
	Base
	Key string
}

Control action

func NewControlGorm added in v0.1.1

func NewControlGorm(m schema.Tabler, key string) *Control

NewControlGorm new control action

func NewControlMgm added in v0.1.1

func NewControlMgm(m mgm.Model, key string) *Control

NewControlMgm new control action

func (*Control) Handler

func (e *Control) Handler() gin.HandlerFunc

Handler action handler

func (*Control) String

func (*Control) String() string

String action name

type Delete

type Delete struct {
	Base
	Key string
}

Delete action

func NewDeleteGorm added in v0.1.1

func NewDeleteGorm(m schema.Tabler, key string) *Delete

NewDeleteGorm new delete action

func NewDeleteMgm added in v0.1.1

func NewDeleteMgm(m mgm.Model, key string) *Delete

NewDeleteMgm new deleteMgm action

func (*Delete) Handler

func (e *Delete) Handler() gin.HandlerFunc

Handler action handler

func (*Delete) String

func (*Delete) String() string

String action name

type Get

type Get struct {
	Base
	Key string
}

Get action

func NewGetGorm added in v0.1.1

func NewGetGorm(m schema.Tabler, key string) *Get

NewGetGorm new get action

func NewGetMgm added in v0.1.1

func NewGetMgm(m mgm.Model, key string) *Get

NewGetMgm new get action

func (*Get) Handler

func (e *Get) Handler() gin.HandlerFunc

Handler action handler

func (*Get) String

func (*Get) String() string

String action name

type LinkConfig

type LinkConfig struct {
	FieldName      string
	CollectionName string
	LocalField     string
	ForeignField   string
}

type Model added in v0.1.1

type Model interface {
	mgm.Model
	schema.Tabler
}

type ModelGorm added in v0.1.1

type ModelGorm struct {
	ID        string         `gorm:"primarykey" json:"id" bson:"_id,omitempty" form:"id" query:"id"`
	CreatedAt time.Time      `json:"createdAt" bson:"createdAt"`
	UpdatedAt time.Time      `json:"updatedAt" bson:"updatedAt"`
	DeletedAt gorm.DeletedAt `gorm:"index" bson:"-" json:"-"`
}

func (*ModelGorm) GetID added in v0.1.1

func (e *ModelGorm) GetID() any

func (*ModelGorm) PrepareID added in v0.1.1

func (e *ModelGorm) PrepareID(_ any) (any, error)

func (*ModelGorm) SetID added in v0.1.1

func (e *ModelGorm) SetID(id any)

func (*ModelGorm) TableName added in v0.1.1

func (e *ModelGorm) TableName() string

type ModelProvider added in v0.1.1

type ModelProvider string
const (
	ModelProviderMgm  ModelProvider = "mgm"
	ModelProviderGorm ModelProvider = "gorm"
)

type Pagination

type Pagination struct {
	Page     int64 `form:"page" query:"page"`
	PageSize int64 `form:"pageSize" query:"pageSize"`
}

Pagination pagination params

func (*Pagination) GetPage

func (e *Pagination) GetPage() int64

func (*Pagination) GetPageSize

func (e *Pagination) GetPageSize() int64
type Search struct {
	Base
	Search response.Searcher
}

Search action

func NewSearchGorm added in v0.1.1

func NewSearchGorm(m Model, search response.Searcher) *Search

NewSearchGorm new search action

func NewSearchMgm added in v0.1.1

func NewSearchMgm(m mgm.Model, search response.Searcher) *Search

NewSearchMgm new search action

func (*Search) Handler

func (e *Search) Handler() gin.HandlerFunc

Handler action handler

func (*Search) String

func (*Search) String() string

String action name

Jump to

Keyboard shortcuts

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