model

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2020 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// OAuth2ScopeTypeBasic scope type basic
	OAuth2ScopeTypeBasic = "basic"
)

Variables

This section is empty.

Functions

func ConvertCodeSliceToStringSlice added in v0.3.0

func ConvertCodeSliceToStringSlice(codes []Code) (v []string)

ConvertCodeSliceToStringSlice code slice 转 string slice

func ConvertCodeToString added in v0.5.1

func ConvertCodeToString(code Code) string

ConvertCodeToString code 转 string

func ConvertIDSliceToInt64Slice added in v0.4.0

func ConvertIDSliceToInt64Slice(ids []ID) (v []int64)

ConvertIDSliceToInt64Slice id slice 转 int64 slice

func ConvertIDToString added in v0.5.1

func ConvertIDToString(id ID) uint64

ConvertIDToString ID 转 string

func DiffCodeSlice added in v0.4.2

func DiffCodeSlice(src []Code, in []Code) (added []Code, deleted []Code)

DiffCodeSlice ...

func DiffIDSlice added in v0.4.0

func DiffIDSlice(src []ID, in []ID) (added []ID, deleted []ID)

DiffIDSlice ...

Types

type CacheCodePrimaryKey added in v0.3.0

type CacheCodePrimaryKey struct {
	Code Code `json:"code"`
}

CacheCodePrimaryKey ...

type CacheIDPrimaryKey added in v0.3.0

type CacheIDPrimaryKey struct {
	ID ID `json:"id"`
}

CacheIDPrimaryKey ...

type Code added in v0.3.0

type Code string

Code ...

func ConvertStringSliceToCodeSlice added in v0.4.2

func ConvertStringSliceToCodeSlice(codes []string) (v []Code)

ConvertStringSliceToCodeSlice string slice 转 code slice

func ConvertStringToCode added in v0.4.0

func ConvertStringToCode(code string) Code

ConvertStringToCode string 转 code

type CodeModel added in v0.3.0

type CodeModel struct {
	Code      Code       `json:"code" gorm:"primary_key;column:code"`
	CreatedAt time.Time  `json:"created_at" sql:"index" gorm:"column:created_at"`
	UpdatedAt time.Time  `json:"updated_at" gorm:"column:updated_at"`
	DeletedAt *time.Time `json:"deleted_at" sql:"index" gorm:"column:deleted_at"`
}

CodeModel ...

type ID added in v0.3.0

type ID uint64

ID ...

func ConvertInt64SliceToIDSlice added in v0.4.0

func ConvertInt64SliceToIDSlice(ints []int64) (v []ID)

ConvertInt64SliceToIDSlice int64 slice 转 id slice

func ConvertStringToID added in v0.3.0

func ConvertStringToID(id string) ID

ConvertStringToID string 转 ID

type Model

type Model struct {
	ID        ID         `json:"id" gorm:"primary_key;column:id"`
	CreatedAt time.Time  `json:"created_at" sql:"index" gorm:"column:created_at"`
	UpdatedAt time.Time  `json:"updated_at" gorm:"column:updated_at"`
	DeletedAt *time.Time `json:"deleted_at" sql:"index" gorm:"column:deleted_at"`
}

Model ...

type OAuth2Client

type OAuth2Client struct {
	ClientID     ID     `json:"client_id" gorm:"primary_key;column:client_id"`
	ClientSecret string `json:"client_secret" gorm:"column:client_secret"`
	RedirectURI  string `json:"redirect_uri" gorm:"column:redirect_uri"`
}

OAuth2Client ...

func (*OAuth2Client) GetClientID

func (c *OAuth2Client) GetClientID() string

GetClientID get client id as string.

func (*OAuth2Client) TableName

func (*OAuth2Client) TableName() string

TableName ...

type OAuth2ClientInfo

type OAuth2ClientInfo struct {
	ClientID    ID     `json:"client_id" gorm:"primary_key;column:client_id"`
	Name        string `json:"name" gorm:"column:name"`
	Website     string `json:"website" gorm:"column:website"`
	Profile     string `json:"profile" gorm:"column:profile"`
	Description string `json:"description" gorm:"column:description"`
}

OAuth2ClientInfo ...

func (*OAuth2ClientInfo) TableName

func (*OAuth2ClientInfo) TableName() string

TableName ...

type OAuth2ClientScope added in v0.3.0

type OAuth2ClientScope struct {
	Model
	OAuth2ClientID ID   `json:"oauth2_client_id" gorm:"column:oauth2_client_id"`
	ScopeCode      Code `json:"scope_code" gorm:"column:scope_code"`
}

OAuth2ClientScope OAuth2客户端范围

func (*OAuth2ClientScope) TableName added in v0.3.0

func (*OAuth2ClientScope) TableName() string

TableName 表明

type OAuth2Scope

type OAuth2Scope struct {
	CodeModel
	Name        string `json:"name"`
	Description string `json:"description"`
	Type        string `json:"type"` // basic,
}

OAuth2Scope ...

func (*OAuth2Scope) TableName

func (*OAuth2Scope) TableName() string

TableName ...

type Organization

type Organization struct {
	Model
	Name               string          `json:"name" gorm:"column:name"`
	Description        string          `json:"description" gorm:"column:description"`
	Code               Code            `json:"code" gorm:"column:code"`
	ParentID           ID              `json:"parent_id" gorm:"column:parent_id"`
	ChildOrganizations []*Organization `json:"child_organizations" gorm:"-"`
}

Organization ...

type Pagination added in v0.3.0

type Pagination struct {
	Total    int64 `json:"total"`
	PageSize int   `json:"pageSize"`
	Current  int   `json:"current"`
}

Pagination ...

func NewPagination added in v0.3.0

func NewPagination(ctx *gin.Context) *Pagination

NewPagination ...

func (*Pagination) GetLimit added in v0.3.0

func (p *Pagination) GetLimit() int

GetLimit 获取显示条数

func (*Pagination) GetSkip added in v0.3.0

func (p *Pagination) GetSkip() int

GetSkip 获取跳过条数

type Resource added in v0.3.0

type Resource struct {
	Model
	Name           string `json:"name"`
	Secret         string `json:"secret"`
	Description    string `json:"description"`
	OrganizationID ID     `json:"organization_id"`
}

Resource 资源

type ResourceAction added in v0.5.0

type ResourceAction struct {
	Model
	Code             Code   `json:"code" gorm:"column:code"`
	Name             string `json:"name" gorm:"column:name"`
	Group            string `json:"group" gorm:"column:group"`
	Description      string `json:"description" gorm:"column:description"`
	ResourceServerID ID     `json:"resource_server_id" gorm:"column:resource_server_id"`
}

ResourceAction web组件

type ResourceMenu added in v0.5.0

type ResourceMenu struct {
	Model
	Name               string          `json:"name" gorm:"column:name"`
	URL                string          `json:"url" gorm:"column:url"`
	Icon               string          `json:"icon" gorm:"column:icon"`
	Level              int             `json:"level" gorm:"column:level"` // 等级、菜单深度
	SerialNumber       int             `json:"serial_number" gorm:"column:serial_number"`
	Leaf               bool            `json:"leaf" gorm:"column:leaf"` // 是:子组件,否:是父组件
	ParentID           ID              `json:"parent_id" gorm:"column:parent_id"`
	ResourceServerID   ID              `json:"resource_server_id" gorm:"column:resource_server_id"`
	ChildResourceMenus []*ResourceMenu `json:"child_resource_menus" gorm:"-"`
}

ResourceMenu 资源菜单

type ResourceRoute added in v0.5.0

type ResourceRoute struct {
	Model
	Name             string `json:"name"`
	Path             string `json:"path"`
	Method           string `json:"method"` // 可多选(POST,GET,PUT,DELETE)等
	ResourceServerID ID     `json:"resource_server_id"`
}

ResourceRoute 资源Web路由

type ResultOrganization added in v0.3.0

type ResultOrganization struct {
	Organization       *Organization `json:"organization"`
	ParentOrganization *Organization `json:"parent_organization"`
}

ResultOrganization 返回组织信息

type ResultResourceAction added in v0.5.0

type ResultResourceAction struct {
	ResourceServer *Resource       `json:"resource_server"`
	ResourceAction *ResourceAction `json:"resource_action"`
}

ResultResourceAction 返回资源服务器中的动作

type ResultResourceMenu added in v0.5.0

type ResultResourceMenu struct {
	ResourceServer     *Resource     `json:"resource_server"`
	ResourceMenu       *ResourceMenu `json:"resource_menu"`
	ParentResourceMenu *ResourceMenu `json:"parent_resource_menu"`
}

ResultResourceMenu 返回资源服务器中的菜单

type ResultResourceRoute added in v0.5.0

type ResultResourceRoute struct {
	ResourceServer *Resource      `json:"resource_server"`
	ResourceRoute  *ResourceRoute `json:"resource_route"`
}

ResultResourceRoute 返回资源服务器中的路由

type ResultResourceServer added in v0.4.0

type ResultResourceServer struct {
	ResourceServer *Resource     `json:"resource_server"`
	Organization   *Organization `json:"organization"`
}

ResultResourceServer 返回资源服务器

type ResultRole added in v0.4.0

type ResultRole struct {
	Role         *Role         `json:"role"`
	ParentRole   *Role         `json:"parent_role"`
	Organization *Organization `json:"organization"`
}

ResultRole 角色

type ResultSelect added in v0.3.0

type ResultSelect struct {
	Value interface{} `json:"value"`
	Label string      `json:"label"`
}

ResultSelect 返回select

type ResultTree added in v0.4.0

type ResultTree struct {
	Title    string        `json:"title"`
	Value    interface{}   `json:"value"`
	Key      interface{}   `json:"key"`
	Children []*ResultTree `json:"children"`
}

ResultTree 返回Tree

func RecursiveOrganizationToTree added in v0.4.0

func RecursiveOrganizationToTree(orgs []*Organization) (result []*ResultTree)

RecursiveOrganizationToTree 递归organization转tree

type ResultTreeNode added in v0.4.0

type ResultTreeNode struct {
	ID     string      `json:"id"`
	PID    string      `json:"pId"`
	Value  interface{} `json:"value"`
	Title  string      `json:"title"`
	IsLeaf bool        `json:"isLeaf"` // 是否是叶子节点,叶子节点没有子节点数据
}

ResultTreeNode 返回 tree node

func RecursiveRoleToTreeNode added in v0.4.0

func RecursiveRoleToTreeNode(roles []*Role) (treeNodes []*ResultTreeNode)

RecursiveRoleToTreeNode 递归role转tree node

type ResultTreeSelect added in v0.4.0

type ResultTreeSelect struct {
	Title    string              `json:"title"`
	Value    interface{}         `json:"value"`
	Key      string              `json:"key"`
	Children []*ResultTreeSelect `json:"children"`
}

ResultTreeSelect 返回TreeSelect

func RecursiveResourceMenuToTreeSelect added in v0.5.0

func RecursiveResourceMenuToTreeSelect(menus []*ResourceMenu) (treeSelects []*ResultTreeSelect)

RecursiveResourceMenuToTreeSelect 递归菜单转tree select

func RecursiveRoleToTreeSelect added in v0.4.0

func RecursiveRoleToTreeSelect(roles []*Role) (treeSelects []*ResultTreeSelect)

RecursiveRoleToTreeSelect 递归role转tree select

type ResultUserInfo added in v0.3.0

type ResultUserInfo struct {
	*User
	*UserInfo
}

ResultUserInfo 返回用户信息

type Role

type Role struct {
	CodeModel
	Name           string  `json:"name"`
	Description    string  `json:"description"`
	ParentCode     Code    `json:"parent_code"`
	OrganizationID ID      `json:"organization_id" gorm:"column:organization_id"`
	ChildRoles     []*Role `json:"child_roles" gorm:"-"`
}

Role 角色

type RoleResourceRelation added in v0.4.3

type RoleResourceRelation struct {
	Model
	RoleCode         Code                     `json:"role_code" gorm:"column:role_code"`
	RelationType     RoleResourceRelationType `json:"relation_type" gorm:"column:relation_type"`
	RelationID       ID                       `json:"relation_id" gorm:"column:relation_id"`
	ResourceServerID ID                       `json:"resource_server_id" gorm:"column:resource_server_id"`
}

RoleResourceRelation 角色资源关系表

type RoleResourceRelationType added in v0.4.3

type RoleResourceRelationType int

RoleResourceRelationType 角色资源关系类型

var (
	// RoleResourceRelationTypeRoute 路由
	RoleResourceRelationTypeRoute RoleResourceRelationType = 1
	// RoleResourceRelationTypeMenu 菜单
	RoleResourceRelationTypeMenu RoleResourceRelationType = 2
	// RoleResourceRelationTypeAction 动作
	RoleResourceRelationTypeAction RoleResourceRelationType = 3
)

type SessionAccount

type SessionAccount struct {
	UserID   ID
	UserName string
	Nickname string
	Picture  string
}

SessionAccount ...

type TableListData added in v0.3.0

type TableListData struct {
	List       interface{} `json:"list"`
	Pagination Pagination  `json:"pagination"`
}

TableListData ...

func NewTableListData added in v0.3.0

func NewTableListData(pagination Pagination, list interface{}) *TableListData

NewTableListData ...

type User

type User struct {
	Model
	Username  string `json:"username" gorm:"column:username"`
	Password  string `json:"password" gorm:"column:password"`
	WxUnionID string `json:"wx_union_id" gorm:"column:wx_union_id"` // 微信unionid
}

User ...

type UserInfo added in v0.1.0

type UserInfo struct {
	Model
	UserID        ID     `json:"user_id" gorm:"column:user_id"`
	Nickname      string `json:"nickname" gorm:"column:nickname"`
	Picture       string `json:"picture" gorm:"column:picture;type:MEDIUMTEXT"` // 支持存储base64头像
	Gender        int    `json:"gender" gorm:"column:gender"`
	Email         string `json:"email" gorm:"column:email"`
	EmailVerified bool   `json:"email_verified" gorm:"column:email_verified"`
	Phone         string `json:"phone" gorm:"column:phone"`
	PhoneVerified bool   `json:"phone_verified" gorm:"column:phone_verified"`
}

UserInfo 用户信息

type UserOrganization added in v0.4.0

type UserOrganization struct {
	Model
	UserID         ID `json:"user_id" gorm:"column:user_id"`
	OrganizationID ID `json:"organization_id" gorm:"column:organization_id"`
}

UserOrganization 用户组织

type UserRole

type UserRole struct {
	Model
	UserID         ID   `json:"user_id" gorm:"column:user_id"`
	RoleCode       Code `json:"role_code" gorm:"column:role_code"`
	OrganizationID ID   `json:"organization_id" gorm:"column:organization_id"`
}

UserRole 用户权限

Jump to

Keyboard shortcuts

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