model

package
v1.0.18 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ASC sortDirection = iota
	DESC
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseModel

type BaseModel struct {
	// contains filtered or unexported fields
}

func (*BaseModel) AfterFind

func (bm *BaseModel) AfterFind(scope *gorm.DB) (err error)

func (*BaseModel) BeforeCreate added in v1.0.2

func (bm *BaseModel) BeforeCreate(scope *gorm.DB) (err error)

func (*BaseModel) BeforeSave

func (bm *BaseModel) BeforeSave(scope *gorm.DB) (err error)

func (*BaseModel) BeforeUpdate

func (bm *BaseModel) BeforeUpdate(scope *gorm.DB) (err error)

func (*BaseModel) DB

func (bm *BaseModel) DB() *gorm.DB

func (*BaseModel) SetDB

func (bm *BaseModel) SetDB(db *gorm.DB)

func (*BaseModel) SetTX

func (bm *BaseModel) SetTX(db *gorm.DB)

func (*BaseModel) SetTableName

func (bm *BaseModel) SetTableName(tableName string) string

type BaseModeller

type BaseModeller interface {
	DB() *gorm.DB
	SetTX(db *gorm.DB)
}

type Context

type Context interface {
	context.RequestParamContextor
}

type Filter

type Filter struct {
	Key string
	Op  string
	Val interface{}
}

type Model

type Model gorm.DB

func (*Model) Paginate

func (bm *Model) Paginate(model interface{}, c Context, perPage uint) (pagination Pagination, err error)

Model(*Q(&User{}, data, []Sort{}, 1, false)).Paginate(c, perPage)

type Modeller

type Modeller interface {
	BaseModeller
	TableName() string
	Default() interface{}
}

type Pagination

type Pagination struct {
	// contains filtered or unexported fields
}

func (*Pagination) Count

func (p *Pagination) Count() uint

func (*Pagination) CurrentPage

func (p *Pagination) CurrentPage() uint

func (*Pagination) FirstItem

func (p *Pagination) FirstItem() interface{}

func (*Pagination) ItemArr

func (p *Pagination) ItemArr() interface{}

func (*Pagination) LastItem

func (p *Pagination) LastItem() interface{}

func (*Pagination) LastPage

func (p *Pagination) LastPage() uint

func (*Pagination) PerPage

func (p *Pagination) PerPage() uint

func (*Pagination) Total

func (p *Pagination) Total() uint

type Sort

type Sort struct {
	Key       string
	Direction sortDirection
}

type Webroutes added in v1.0.16

type Webroutes struct {
	BaseModel
	ID         uint       `gorm:"column:id;primary_key;auto_increment"`
	RouteName  string     `gorm:"column:routename;type:varchar(255)"`
	Controller string     `gorm:"column:controller;type:varchar(255);unique_index;not null"`
	Function   string     `gorm:"column:Function;type:varchar(255);not null"`
	Path       string     `gorm:"column:path;type:varchar(255);not null"`
	CreatedAt  zone.Time  `gorm:"column:created_at"`
	UpdatedAt  zone.Time  `gorm:"column:updated_at"`
	DeletedAt  *zone.Time `gorm:"column:deleted_at"`
}

func (*Webroutes) TableName added in v1.0.16

func (Webroutes *Webroutes) TableName() string

Directories

Path Synopsis
types

Jump to

Keyboard shortcuts

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