model

package
v0.0.0-...-585f28f Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2024 License: Apache-2.0 Imports: 3 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 struct {
	ID          uint   `gorm:"primaryKey;autoIncrement" json:"id" copier:"ID"`
	Name        string `gorm:"column:name;type:varchar(50);not null" json:"name" copier:"Name"`
	Path        string `gorm:"column:path;type:varchar(50);not null;uniqueIndex:udx_name_path"  copier:"Path"`
	Method      string `gorm:"column:method;type:varchar(50);not null;uniqueIndex:udx_name_path" copier:"Method"`
	Description string `gorm:"column:description;type:varchar(50);not null" json:"description"`
	APIGroup    string `gorm:"column:api_group;type:varchar(50);not null" json:"api_group"`
	CreatedAt   string `gorm:"column:created_at;type:varchar(50);not null" json:"created_at"`
	UpdatedAt   string `gorm:"column:updated_at;type:varchar(50);not null" json:"updated_at"`
}

func (API) TableName

func (API) TableName() string

type Department

type Department struct {
	ID        uint   `gorm:"primaryKey" json:"id"`
	Name      string `json:"name" gorm:"default:null"`
	Status    int    `json:"status" gorm:"default:null"`
	Sort      int    `json:"sort" gorm:"default:null"`
	Principal string `json:"principal" gorm:"default:null"`
	ParentID  int64  `json:"parent_id,omitempty" gorm:"default:null"`
	//User        []User         `gorm:"foreignkey:DepartmentID;" json:"-"`
	Departments []Department   `json:"children,omitempty" gorm:"foreignKey:ParentID;references:ID"`
	Phone       string         `json:"phone" gorm:"default:null"`
	Email       string         `json:"email" gorm:"default:null"`
	CreatedAt   time.Time      `json:"created_at" `
	UpdatedAt   time.Time      `json:"updated_at" `
	DeletedAt   gorm.DeletedAt `gorm:"index" json:"-"`
}

func (Department) TableName

func (Department) TableName() string
type Menu struct {
	ID        uint           `gorm:"primaryKey" json:"id" copier:"ID"`
	Name      string         `json:"name" gorm:"default:null" copier:"Name"`
	Path      string         `json:"path" gorm:"default:null" copier:"Path"`
	Component string         `json:"component" gorm:"default:null" copier:"Component"`
	Redirect  string         `json:"redirect" gorm:"default:null" copier:"Redirect"`
	Layout    int            `json:"layout" gorm:"default:null" copier:"Layout"`
	Icon      string         `json:"icon" gorm:"default:null" copier:"Icon"`
	Type      MenuType       `json:"type" gorm:"default:null" copier:"Type"`
	Remark    string         `gorm:"column:remark" copier:"Remark"`
	Link      string         `json:"link" copier:"Link"`
	Sort      int            `json:"sort"  copier:"Sort"`
	Hidden    int            `json:"hidden" copier:"Hidden"`
	Pid       *int64         `gorm:"column:pid" json:"pid,omitempty" copier:"Pid"`
	Children  []*Menu        `json:"children,omitempty" gorm:"foreignKey:Pid;references:ID" copier:"Children"`
	API       []API          `gorm:"many2many:menu_apis" copier:"API"`
	CreatedAt time.Time      `json:"created_at" copier:"CreatedAt"`
	UpdatedAt time.Time      `json:"updated_at" copier:"UpdatedAt"`
	DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
}
func (Menu) TableName() string
type MenuType int
const (
	MenuTypeDir MenuType = iota
	MenuTypeMenu
	MenuTypeButton
)

type Role

type Role struct {
	ID     uint   `gorm:"primaryKey" json:"id"`
	Name   string `json:"name" form:"name" query:"name"`
	Order  int    `json:"order" form:"order" query:"order"`
	Mark   string `json:"mark" form:"mark" query:"mark"`
	Status int    `gorm:"column:status"`
	Menus  []Menu `gorm:"many2many:role_menus;" json:"-"`
	//User      []User `gorm:"many2many:user_role;" json:"-"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
}

func (Role) TableName

func (Role) TableName() string

type Time

type Time time.Time

func (*Time) MarshalJSON

func (t *Time) MarshalJSON() ([]byte, error)

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(data []byte) (err error)

type User

type User struct {
	ID           uint           `gorm:"primaryKey" json:"id"`
	Name         string         `json:"name,omitempty" form:"name" query:"name"`
	Phone        string         `json:"phone,omitempty" form:"phone" query:"phone"`
	Status       int            `json:"status,omitempty" form:"status" query:"status"`
	Account      string         `json:"account,omitempty" form:"account" query:"account"`
	Password     string         `json:"password,omitempty" form:"password" query:"password"`
	DepartmentID uint           `json:"department_id,omitempty" form:"department_id" query:"department_id"`
	RoleID       uint           `json:"role_id,omitempty" form:"role_id" query:"role_id"`
	Role         []Role         `gorm:"many2many:user_role;" json:"role,omitempty"`
	Sex          int            `gorm:"column:sex"`
	Posts        string         `gorm:"column:posts"`
	Avatar       string         `gorm:"column:avatar"`
	Email        string         `gorm:"column:email"`
	CreatedAt    time.Time      `json:"created_at" `
	UpdatedAt    time.Time      `json:"updated_at" `
	DeletedAt    gorm.DeletedAt `gorm:"index" json:"-"`
}

func (User) TableName

func (User) TableName() string

Jump to

Keyboard shortcuts

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