model

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2024 License: Apache-2.0 Imports: 3 Imported by: 8

Documentation

Index

Constants

View Source
const (
	Success                   = 20000
	InternalServerError       = 50000
	BadRequest                = 40000
	Unauthorized              = 40001
	ErrRecordNotFound         = 40002
	UserNameOrPasswordIsWrong = 41001
	UserIsNotExist            = 41002
	NoPermission              = 41003
	TokenInvalid              = 41004
	TokenExpired              = 41005
	UserDisabled              = 41006
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CommonDetailResponse

type CommonDetailResponse struct {
	CommonResponse
	Data interface{} `json:"data"`
}

type CommonRequest

type CommonRequest struct {
	PageInfo
	Token    string `json:"token"`
	TenantID string `json:"tenantID" form:"tenantID" uri:"tenantID"`
}

type CommonResponse

type CommonResponse struct {
	PageInfo
	Code    int    `json:"code"`
	Message string `json:"message"`
}

type DeleteRequest

type DeleteRequest struct {
	PageName string `json:"pageName"`
	ID       string `json:"id"`
}

type Empty

type Empty struct{}

type EnableRequest

type EnableRequest struct {
	PageName string `json:"pageName"`
	ID       string `json:"ID"`
	Enable   bool   `json:"enable"`
}

type GetById

type GetById struct {
	ID string `json:"id" form:"id" uri:"id"`
}

Find by id structure

type IdsReq

type IdsReq struct {
	IDs []string `json:"ids" form:"ids" uri:"ids"`
}

type Model

type Model struct {
	ID        string         `json:"id" gorm:"primarykey;size:36" copier:"-"`
	CreatedAt time.Time      `json:"createdAt" copier:"-"`
	UpdatedAt time.Time      `json:"updatedAt" gorm:"index" copier:"-"`
	DeletedAt gorm.DeletedAt `json:"deletedAt" gorm:"index" copier:"-"`
}

func (*Model) BeforeCreate

func (u *Model) BeforeCreate(tx *gorm.DB) (err error)

type PageInfo

type PageInfo struct {
	PageIndex  int64  `json:"pageIndex" form:"pageIndex" uri:"pageIndex"`
	PageSize   int64  `json:"pageSize" form:"pageSize" uri:"pageSize"`
	Pages      int64  `json:"pages" form:"pages" uri:"pages"`
	Records    int64  `json:"records" form:"records" uri:"records"`
	OrderField string `json:"orderField" form:"orderField" uri:"orderField"`
	Desc       bool   `json:"desc" form:"desc" uri:"desc"`
	Total      int64  `json:"total" form:"total" uri:"total"`
	Current    int64  `json:"current" form:"current" uri:"current"`
}

Paging common input parameter structure

func (PageInfo) GetOrder

func (p PageInfo) GetOrder(defaultOrderStr string) string

type TenantModel

type TenantModel struct {
	Model
	TenantID string `json:"tenantID" gorm:"index;size:36"`
}

Jump to

Keyboard shortcuts

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