models

package
v0.0.0-...-594642b Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecSql

func ExecSql(filePath string) error

func InitDb

func InitDb() error

func Ioutil

func Ioutil(filePath string) (string, error)

Types

type BaseModel

type BaseModel struct {
	CreatedAt int32          `json:"createdAt"`
	UpdatedAt int32          `json:"-"`
	DeletedAt gorm.DeletedAt `json:"-" gorm:"default:null" sql:"index"`
}

type Casbin

type Casbin struct {
	PType string `json:"p_type" gorm:"size:100;"`
	V0    string `json:"v0" gorm:"size:100;"`
	V1    string `json:"v1" gorm:"size:100;"`
	V2    string `json:"v2" gorm:"size:100;"`
	V3    string `json:"v3" gorm:"size:100;"`
	V4    string `json:"v4" gorm:"size:100;"`
	V5    string `json:"v5" gorm:"size:100;"`
}

func (Casbin) TableName

func (Casbin) TableName() string
type Menu struct {
	ID           uint64 `json:"id" gorm:"primary_key;AUTO_INCREMENT"`         // id
	Name         string `json:"name" gorm:"size:128;comment:菜单名称;"`           // 菜单名称
	Title        string `json:"title" gorm:"size:128;comment:菜单标题;"`          // 菜单标题
	Icon         string `json:"icon" gorm:"size:128;comment:菜单图标;"`           // 菜单图标
	Path         string `json:"path" gorm:"size:128;comment:路由地址;"`           // 路由地址
	Paths        string `json:"paths" gorm:"size:50;comment:菜单图标;"`           //层级顺序
	MenuType     uint8  `json:"menu_type" gorm:"comment:菜单类型;"`               //菜单类型
	Action       string `json:"action" gorm:"size:16;comment:请求方式;"`          //请求方式
	Permission   string `json:"permission" gorm:"size:128;comment:页面权限标识;"`   //页面权限标识
	PermissionId uint64 `json:"permission_id" gorm:"index;comment:菜单对应权限id;"` // 菜单对应权限id
	ParentId     uint64 `json:"parent_id" gorm:"size:11;comment:菜单父级id;"`     //菜单父级id
	NoCache      uint8  `json:"no_cache" gorm:"default:0;comment:缓存;"`        //缓存
	Component    string `json:"component" gorm:"size:255;comment:组件路径;"`      // 组件路径
	Sort         uint8  `json:"sort" gorm:"comment:菜单排序;"`                    // 排序
	Visible      uint8  `json:"visible" gorm:"comment:菜单状态;"`                 // 菜单状态
	CreateBy     string `json:"create_by" gorm:"size:128;comment:创建者;"`       // 创建者
	UpdateBy     string `json:"update_by" gorm:"size:128;comment:修改者;"`       // 修改者
	IsFrame      uint8  `json:"is_frame" gorm:"default:0;comment:是否外链;"`      // 是否外链
	Children     []Menu `json:"children" gorm:"-"`
	BaseModel

} //@name Menu

func DiguiMenu

func DiguiMenu(menulist *[]Menu, menu Menu) Menu
func (e *Menu) GetByRole(roleId uint64) (Menus []Menu, err error)
func (e *Menu) SetMenuRole(roleId uint64) (m []Menu, err error)
func (Menu) TableName() string

type SysDictData

type SysDictData struct {
	Id         uint64 `gorm:"primary_key;auto_increment;" json:"id"`
	DictTypeId uint64 `gorm:"" json:"dict_type_id"`                         //字典类型
	Label      string `gorm:"size:128;comment:标签" json:"label"`             //数据标签
	Sort       uint8  `gorm:"comment:排序" json:"sort"`                       //显示顺序
	Value      uint8  `gorm:"comment:数据键值;" json:"value"`                   //数据键值
	Status     uint8  `gorm:"comment:状态 0 正常 1 停用;default:0" json:"status"` //状态
	IsDefault  uint8  `gorm:"comment:默认 ;" json:"is_default"`               // 默认
	CreateBy   uint64 `gorm:"comment:创建者;" json:"create_by"`                //创建者
	UpdateBy   uint64 `gorm:"comment:更新者;" json:"update_by"`                //更新者
	Remark     string `gorm:"size:255;" json:"remark"`                      //备注
	BaseModel

	Params    string `gorm:"-" json:"params"`
	DataScope string `gorm:"-" json:"dataScope"`

} //@name DictData

func (*SysDictData) Get

func (e *SysDictData) Get() ([]SysDictData, error)

func (SysDictData) TableName

func (SysDictData) TableName() string

type SysDictType

type SysDictType struct {
	Id       uint64 `gorm:"primary_key;auto_increment;" json:"id"`
	Name     string `gorm:"size:128;comment:字典名称" json:"name"` //字典名称
	Type     string `gorm:"size:128;" json:"type"`             //字典类型
	Status   uint8  `gorm:"comment:状态 0正常 1停用;" json:"status"` //状态
	CreateBy uint64 `gorm:"comment:创建者;" json:"-"`             //创建者
	UpdateBy uint64 `gorm:"comment:更新者;" json:"-"`             //更新者
	Remark   string `gorm:"size:255;comment:备注" json:"remark"` //备注

	Datas []SysDictData `gorm:"foreignKey:DictTypeId" json:"-"` //
	BaseModel
}

func (SysDictType) TableName

func (SysDictType) TableName() string

type SysRole

type SysRole struct {
	ID       uint64 `json:"id" gorm:"primary_key;AUTO_INCREMENT"`
	RoleName string `json:"role_name" gorm:"size:50;comment:'角色名称'"`               // 角色名称
	Status   bool   `json:"status" gorm:"size:1;comment:'状态 1 正常 0 删除';default:1"` // 状态
	// RoleKey  string `json:"roleKey" gorm:"size:128;comment:'角色唯一标识'"`              // 角色唯一标识
	CreateBy uint64 `json:"create_by" gorm:"comment:'创建者'"` // 创建者
	UpdateBy uint64 `json:"update_by" gorm:"comment:'修改者'"` // 修改者
	Remark   string `json:"remark" gorm:"comment:'备注'"`     //备注
	BaseModel
}

func (SysRole) TableName

func (SysRole) TableName() string

type SysRoleMenu

type SysRoleMenu struct {
	RoleId uint64 `gorm:"comment:角色id;index" json:"role_id"`
	MenuId uint64 `gorm:"comment:菜单id;index" json:"menu_id"`
	BaseModel
}

func (*SysRoleMenu) GetPermits

func (rm *SysRoleMenu) GetPermits() ([]string, error)

func (SysRoleMenu) TableName

func (SysRoleMenu) TableName() string

type SysSetting

type SysSetting struct {
	ID   uint64 `json:"id" gorm:"primary_key;AUTO_INCREMENT"`
	Name string `json:"name" gorm:"type:varchar(256);"`
	BaseModel
}

func (*SysSetting) Get

func (s *SysSetting) Get() (r SysSetting, e error)

func (SysSetting) TableName

func (SysSetting) TableName() string

type SysUser

type SysUser struct {
	ID       uint64  `gorm:"primary_key"`                                                                             // 用户id
	Phone    string  `gorm:"size:11;unique_index;not null;comment:'用户登录手机号'" json:"phone"`                            // 手机号
	Password string  `json:"-"  gorm:"size:64;comment:'用户登录密码'"`                                                      // 密码
	NickName string  `json:"nickName" gorm:"size:20;default:'jerry';comment:'用户昵称'" `                                 // 昵称
	Avatar   string  `json:"avatar" gorm:"size:128;default:'http://qmplusimg.henrongyi.top/head.png';comment:'用户头像'"` //头像
	RoleId   uint64  `gorm:"comment:'角色id';" json:"role_id"`                                                          // 角色id
	Role     SysRole `gorm:"ForeignKey:RoleId"`
	LogindAt int32   `json:"-" gorm:"default:null"` // 登录时间
	BaseModel
}

func (SysUser) TableName

func (SysUser) TableName() string

Jump to

Keyboard shortcuts

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