param

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: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIQuery

type APIQuery struct {
	Page  int `json:"page" form:"page" query:"page"`
	Count int `json:"count" form:"count" query:"count"`
}

func (*APIQuery) Limit

func (q *APIQuery) Limit() int

func (*APIQuery) Offset

func (q *APIQuery) Offset() int

type ChildAPI

type ChildAPI struct {
	Method Method `json:"method" query:"method" form:"method" copier:"Method"`
	URL    string `json:"url" query:"url" form:"url" copier:"URL"`
	Name   string `json:"name" form:"name" query:"name" copier:"Name"`
}

type Department

type Department struct {
	Name      *string `json:"name"`
	ParentID  *int64  `json:"parent_id"`
	Email     *string `json:"email"`
	Phone     *string `json:"phone"`
	Status    *int    `json:"status"`
	Sort      *int    `json:"sort"`
	Principal *string `json:"principal" `
}

func (Department) Data

func (r Department) Data() ([]field.Expr, model.Department)

type DepartmentQuery

type DepartmentQuery struct {
	APIQuery
	Name   string `json:"name"`
	Status int    `json:"status"`
}

type Login

type Login struct {
	Account   string `json:"account" `
	Password  string `json:"password"`
	AutoLogin bool   `json:"autoLogin"`
	Type      string `json:"type"`
}

type LoginResponse

type LoginResponse struct {
	Token string `json:"token"`
}
type Menu struct {
	Type      model.MenuType `json:"type" copier:"Type"`
	API       []ChildAPI     `json:"apis" query:"apis" form:"apis" copier:"API" `
	Component *string        `json:"component,omitempty" copier:"Component"`
	Hidden    *int           `json:"hidden,omitempty" copier:"Hidden"`
	Icon      *string        `json:"icon,omitempty" copier:"Icon"`
	Layout    *int           `json:"layout,omitempty" copier:"Layout"`
	Link      *string        `json:"link,omitempty" copier:"Link"`
	Name      *string        `json:"name,omitempty" copier:"Name"`
	Path      *string        `json:"path,omitempty" copier:"Path"`
	PID       *int64         `json:"pid,omitempty" copier:"Pid"`
	Redirect  *string        `json:"redirect,omitempty" copier:"Redirect"`
	Remark    *string        `json:"remark,omitempty" copier:"Remark"`
	Role      []int64        `json:"role,omitempty" copier:"Role"`
	Sort      *int           `json:"sort,omitempty" copier:"Sort"`
	Status    *int64         `json:"status,omitempty" copier:"Status"`
}

Menu 菜单 Type: 1:目录 2:菜单 3:按钮 API: 接口规则 Link: 外链地址 Identify: 菜单标识 Sort: 排序 Hidden: 是否隐藏 1=是 2=否 Cache: 是否缓存 1=是 2=否 Fixed: 是否固定 1=是 2=否 Name: 菜单名称 Path: 路由地址 Component: 组件路径 PID: 父菜单ID Icon: 图标 Remark: 备注

func (m Menu) Data() ([]field.Expr, model.Menu)
func (m Menu) Fields() []field.Expr

Fields 数据库插入需要的字段,代码太长还得想办法优化

func (m Menu) Model() (model.Menu, error)
type MenuParam struct {
	APIQuery
	Component string `json:"component" query:"component" form:"component"`
	Name      string `json:"name" query:"name" form:"name"`
	Path      string `json:"path" query:"path" form:"path"`
	Type      int    `json:"type" query:"type" form:"type"`
}
func (m MenuParam) Condition() []gen.Condition
type MenuResp struct {
	API       []ChildAPI     `json:"apis,omitempty"`
	Children  []MenuResp     `json:"children,omitempty"`
	Component string         `json:"component"`
	Hidden    int            `json:"hidden,omitempty"`
	Icon      string         `json:"icon,omitempty"`
	ID        uint           `json:"id,omitempty"`
	Identify  string         `json:"identify,omitempty"`
	Label     string         `json:"label,omitempty"`
	Layout    int            `json:"layout,omitempty"`
	Link      string         `json:"link,omitempty"`
	Name      string         `json:"name"`
	Path      string         `json:"path"`
	PID       *int64         `json:"pid"`
	Redirect  string         `json:"redirect,omitempty"`
	Remark    string         `json:"remark,omitempty"`
	Role      []int64        `json:"role,omitempty"`
	Sort      int            `json:"sort,omitempty"`
	Status    int64          `json:"status,omitempty"`
	Type      model.MenuType `json:"type"`
	Value     int64          `json:"value,omitempty"`
}

MenuResp 菜单 API api接口 Cache 是否缓存 1=是 2=否 Children 子菜单 Component 组件路径 Fixed 是否固定 1=是 2=否 Hidden 是否隐藏 1=是 2=否 Icon 图标 ID 菜单id Identify 菜单标识符 Label 菜单名称 Layout 布局 Link 外链地址 Name 菜单名称 Path 路由路径 PID 父菜单id Redirect 重定向 Remark 备注 Role 角色id列表 Sort 排序 Status 状态 1=启用 2=禁用 Type 类型 1=目录 2=菜单 3=按钮

func MentModel

func MentModel(v *model.Menu) (MenuResp, error)
func MenuModelResp(child []*model.Menu) ([]MenuResp, error)

type Method

type Method string
const (
	Delete Method = "DELETE"
	Get    Method = "GET"
	Post   Method = "POST"
	Put    Method = "PUT"
)

type Role

type Role struct {
	Mark   *string `json:"mark,omitempty"`
	Menus  []uint  `json:"menus,omitempty"`
	Name   *string `json:"name,omitempty"`
	Order  *int    `json:"order,omitempty"`
	Status *int    `json:"status,omitempty"`
}

Role 角色 Mark 备注 Menus 关联菜单 Name 角色名称 Order 排序 Status 状态 1=启用 其他禁用

func (Role) Data

func (r Role) Data() ([]field.Expr, model.Role)

type RoleMenu

type RoleMenu struct {
	MenuID  []int64 `json:"menu_id" form:"menu_id" query:"menu_id"`
	Creator string  `json:"creator" form:"creator" query:"creator"`
}

type RoleQuery

type RoleQuery struct {
	Name  string `json:"name" `
	State int    `json:"state" `
	APIQuery
}

type RoleResp

type RoleResp struct {
	Id       uint    `json:"id"`
	Name     string  `json:"name"`
	Sort     int     `json:"sort"`
	Status   int     `json:"status"`
	Mark     string  `json:"mark"`
	CreateAt string  `json:"create_at"`
	Menus    []int64 `json:"menus"`
}

type UserBody

type UserBody struct {
	// 账号
	Account *string `json:"account,omitempty"`
	// 头像
	Avatar *string `json:"avatar,omitempty"`
	// 部门Id
	DepartmentID *uint `json:"department_id,omitempty"`
	// 邮箱
	Email *string `json:"email,omitempty"`
	ID    *uint   `json:"id,omitempty"`
	// 昵称
	Name *string `json:"name,omitempty"`
	// 密码
	Password *string `json:"password,omitempty"`
	// 手机号码
	Phone *string `json:"phone,omitempty"`
	// 岗位
	Posts *string `json:"posts,omitempty"`
	// 角色id
	RoleID *[]uint `json:"role_id,omitempty"`
	// 性别
	Sex *int `json:"sex,omitempty"`
	// 状态
	Status *int `json:"status,omitempty"`
}

func (UserBody) Data

func (u UserBody) Data() ([]field.Expr, model.User)

type UserParam

type UserParam struct {
	APIQuery
	CreateEnd    *string `json:"create_end" form:"create_end" query:"create_end"`
	CreateStart  *string `json:"create_start" form:"create_start" query:"create_start"`
	Key          *string `json:"key" form:"key" query:"key"`
	Phone        *string `json:"phone" form:"phone" query:"phone"`
	DepartmentId *uint   `json:"department_id" form:"department_id" query:"department_id"`
	Status       int     `json:"status" form:"status" query:"status" validate:"max=2"`
}

UserParam 用户查询参数 Status 1=启用 2=禁言 CreateEnd 创建结束时间 CreateStart 创建开始时间 Key 关键词,用户名或账号 Phone 手机号

type UserResponse

type UserResponse struct {
	ID           uint         `json:"id"`
	Name         string       `json:"name"`
	Phone        string       `json:"phone"`
	Status       int          `json:"status"`
	Account      string       `json:"account"`
	DepartmentID uint         `json:"department_id"`
	RoleID       []model.Role `json:"role_id"`
	Sex          int          `json:"sex"`
	Posts        string       `json:"posts"`
	Email        string       `json:"email"`
	Avatar       string       `json:"avatar"`
	Password     string       `json:"password"`
	CreatedAt    string       `json:"created_at"`
}

Jump to

Keyboard shortcuts

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