models

package
v0.0.0-...-18a43ce Latest Latest
Warning

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

Go to latest
Published: May 10, 2019 License: MIT Imports: 15 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close()

Close clear db collection

Types

type AuthorizationModel

type AuthorizationModel struct {
	Id uint `form:"id" json:"id,omitempty" comment:""`

	Username string `form:"username" json:"username,omitempty" comment:"昵称/登陆用户名"`

	FullName string `form:"full_name" json:"full_name,omitempty" comment:"真实姓名"`

	Email string `form:"email" json:"email,omitempty" comment:"邮箱"`

	Mobile string `form:"mobile" json:"mobile,omitempty" comment:"手机号码"`

	Password string `form:"password" json:"password,omitempty" comment:"密码"`

	RoleId uint `form:"role_id" json:"role_id,omitempty" comment:"角色ID:2-超级用户,4-普通用户"`

	Status uint `form:"status" json:"status,omitempty" comment:"状态: 1-正常,2-禁用/删除"`

	Avatar string `form:"avatar" json:"avatar,omitempty" comment:"用户头像"`

	Remark string `form:"remark" json:"remark,omitempty" comment:"备注"`

	CreatedAt *time.Time `form:"created_at" json:"created_at,omitempty" comment:""`

	UpdatedAt *time.Time `form:"updated_at" json:"updated_at,omitempty" comment:""`
}

AuthorizationModel authorized identity

func JwtParseUser

func JwtParseUser(tokenString string) (*AuthorizationModel, error)

JwtParseUser parse a jwt token and return an authorized identity

func (*AuthorizationModel) All

func (m *AuthorizationModel) All(q *PaginationQuery) (list *[]AuthorizationModel, total uint, err error)

All get all

func (*AuthorizationModel) Create

func (m *AuthorizationModel) Create() (err error)

Create insert a row

func (*AuthorizationModel) Delete

func (m *AuthorizationModel) Delete() (err error)

Delete a row

func (*AuthorizationModel) Login

func (m *AuthorizationModel) Login(ip string) (*jwtObj, error)

Login by user and record by IP

func (*AuthorizationModel) One

func (m *AuthorizationModel) One() (one *AuthorizationModel, err error)

One get one

func (*AuthorizationModel) TableName

func (m *AuthorizationModel) TableName() string

TableName auth table name

func (*AuthorizationModel) Update

func (m *AuthorizationModel) Update() (err error)

Update a row

type Department

type Department struct {
	Id             uint       `gorm:"column:id" form:"id" json:"id" comment:"部门(业务)表主键" sql:"int(10) unsigned,PRI"`
	ParentId       uint       `gorm:"column:parent_id" form:"parent_id" json:"parent_id" comment:"父级部门ID" sql:"int(10) unsigned,MUL"`
	Name           string     `gorm:"column:name" form:"name" json:"name" comment:"部门名称" sql:"varchar(50)"`
	OpsName        string     `gorm:"column:ops_name" form:"ops_name" json:"ops_name" comment:"运维工程师姓名" sql:"varchar(50)"`
	LeaderName     string     `gorm:"column:leader_name" form:"leader_name" json:"leader_name" comment:"负责人姓名" sql:"varchar(50)"`
	MemberIds      string     `` /* 157-byte string literal not displayed */
	EquipmentCount uint       `gorm:"column:equipment_count" form:"equipment_count" json:"equipment_count" comment:"" sql:"int(255) unsigned"`
	CreatedAt      *time.Time `gorm:"column:created_at" form:"created_at" json:"created_at,omitempty" comment:"" sql:"timestamp"`
	UpdatedAt      *time.Time `gorm:"column:updated_at" form:"updated_at" json:"updated_at,omitempty" comment:"" sql:"timestamp"`
}

Department mysql table departments

func (*Department) All

func (m *Department) All(q *PaginationQuery) (list *[]Department, total uint, err error)

All get all for pagination

func (*Department) Create

func (m *Department) Create() (err error)

Create insert a row

func (*Department) Delete

func (m *Department) Delete() (err error)

Delete destroy a row

func (*Department) One

func (m *Department) One() (one *Department, err error)

One find one row

func (*Department) TableName

func (m *Department) TableName() string

TableName of GORM model

func (*Department) Update

func (m *Department) Update() (err error)

Update a row

type PaginationQuery

type PaginationQuery struct {
	Where  string `form:"where"`
	Fields string `form:"fields"`
	Order  string `form:"order"`
	Offset uint   `form:"offset"`
	Limit  uint   `form:"limit"`
}

PaginationQuery gin handler query binding struct

func (*PaginationQuery) String

func (pq *PaginationQuery) String() string

String to string

Jump to

Keyboard shortcuts

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