model

package
v0.0.0-...-1b41cfb Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PassWordCost 密码加密难度
	PassWordCost = 12
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseModel

type BaseModel struct {
	ID        int        `gorm:"primary_key;unique" json:"id"`
	CreatedAt time.Time  `gorm:"type:datetime;not null" json:"created_at"`
	UpdatedAt time.Time  `gorm:"type:datetime;not null" json:"updated_at"`
	DeletedAt *time.Time `sql:"index" json:"deleted_at"`
	Status    int        `gorm:"not null;default:0" json:"status"`
}

BaseModel model base

type Group

type Group struct {
	BaseModel
	Name string `gorm:"not null;comment:'组名称'"`
	Code string `gorm:"not null;comment:'组编码'"`
}

Group 组

type Module

type Module struct {
	BaseModel
	Name string `gorm:"not null comment:'模块名称'"` // 模块名称
	Code string `gorm:"not null comment:'模块编码'"` // 模块编码
}

Module 模块

type OAuthPlatform

type OAuthPlatform int
const (
	WeChat OAuthPlatform = iota
)

type Office

type Office struct {
	BaseModel
	ParentID int    `gorm:"not null;comment:'上级ID';default:0"` // 上级ID
	Name     string `gorm:"not null;comment:'组织名称'"`           // 组织名称
	Type     int    `gorm:"not null;comment:'组织类型'"`           // 组织类型
}

Office 组织

type Position

type Position struct {
	BaseModel
	ParentID int    `gorm:"not null;comment:'上级ID';default:0"` // 上级ID
	OfficeID int    `gorm:"not null;comment:'组织ID'"`           // 组织ID
	Name     string `gorm:"not null;comment:'职位名称'"`           // 职位名称
	Code     string `gorm:"not null;comment:'职位编码'"`           //职位编码
}

Position 身份,职位

type Proxy

type Proxy struct {
	BaseModel
	Path     string `gorm:"not null comment:'路由路径'"`
	Method   string `gorm:"not null comment:'路由方法'"`
	ModuleID int    `gorm:"not null comment:'模块ID'"`
	HostID   int    `gorm:"not null comment:'主机ID'"`
}

Proxy 代理资源模型

type ProxyHost

type ProxyHost struct {
	BaseModel
	URLScheme string `gorm:"not null comment:'目标协议'"`
	URLHost   string `gorm:"not null comment:'目标地址'"`
	URLPath   string `gorm:"not null comment:'目标路径'"`
	Host      string `gorm:"not null comment:'头地址'"`
}

代理主机模型

type ResRelation

type ResRelation struct {
	BaseModel
	S int                 `gorm:"not null;comment:'主体'"`
	T rrt.ResRelationType `gorm:"not null;comment:'类型'"`
	O int                 `gorm:"not null;comment:'受体'"`
}

ResRelation 资源关联

type Role

type Role struct {
	BaseModel
	Alias string `gorm:"not null comment:'名称'"`
}

Role 角色模型

type RoleRouter

type RoleRouter struct {
	BaseModel
	RoleID   int `gorm:"not null comment:'角色ID'"`
	RouterID int `gorm:"not null comment:'路由ID'"`
}

RoleRouter 角色路由关联

type User

type User struct {
	BaseModel
	UserName       string `gorm:"not null;comment:'用户名'"`
	PasswordDigest string `gorm:"not null;comment:'密码摘要'"`
	Nickname       string `gorm:"not null;comment:'昵称'"`
	Avatar         string `gorm:"size:1000;comment:'头像'"`
	PositionID     int    `gorm:"not null;comment:'身份ID'"`
}

User 用户模型

func GetUser

func GetUser(id interface{}) (User, error)

GetUser 用ID获取用户

func (*User) CheckPassword

func (user *User) CheckPassword(password string) bool

CheckPassword 校验密码

func (*User) SetPassword

func (user *User) SetPassword(password string) error

SetPassword 设置密码

type UserOauth

type UserOauth struct {
	BaseModel
	UserID  int           `gorm:"not null;comment:'用户ID'"`
	OpenID  string        `gorm:"not null;comment:'OpenID'"`
	Channel OAuthPlatform `gorm:"not null;comment:'认证渠道'"`
}

Jump to

Keyboard shortcuts

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