model

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2023 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Department

type Department struct {
	ID primitive.ObjectID `bson:"_id,omitempty" json:"_id"`

	// 父节点
	Parent *primitive.ObjectID `bson:"parent" json:"parent"`

	// 名称
	Name string `bson:"name" json:"name"`

	// 描述
	Description string `bson:"description" json:"description"`

	// 排序
	Sort int64 `bson:"sort" json:"sort"`

	// 创建时间
	CreateTime time.Time `bson:"create_time" json:"-"`

	// 更新时间
	UpdateTime time.Time `bson:"update_time" json:"-"`
}

func NewDepartment

func NewDepartment(name string) *Department

type Manual

type Manual struct {
	// 页面标识,自定义页面接入命名
	Scope string `bson:"scope" json:"scope"`

	// 权限细粒化
	Policies map[string]string `bson:"policies" json:"policies"`
}

type Page

type Page struct {
	ID primitive.ObjectID `bson:"_id,omitempty" json:"_id"`

	// 父节点
	Parent interface{} `bson:"parent" json:"parent"`

	// 名称
	Name string `bson:"name" json:"name"`

	// 字体图标
	Icon string `bson:"icon,omitempty" json:"icon,omitempty"`

	// 种类
	Kind string `bson:"kind" json:"kind"`

	// 形式
	Manifest string `bson:"manifest,omitempty" json:"manifest,omitempty"`

	// Schema 模型,数据集时存在
	Schema *Schema `bson:"schema,omitempty" json:"schema,omitempty"`

	// 数据源,数据聚合时存在
	Source *Source `bson:"source,omitempty" json:"source,omitempty"`

	// 自定义,自定义种类时存在
	Manual *Manual `bson:"manual,omitempty" json:"manual,omitempty"`

	// 排序
	Sort int64 `bson:"sort" json:"sort"`

	// 状态
	Status *bool `bson:"status" json:"status"`

	// 创建时间
	CreateTime time.Time `bson:"create_time" json:"create_time"`

	// 更新时间
	UpdateTime time.Time `bson:"update_time" json:"update_time"`
}

type Panel

type Panel struct {
	// 模式
	Query string `bson:"query" json:"query"`

	// 映射
	Mappings map[string]string `bson:"mappings" json:"mappings"`

	// 样式
	Style map[string]interface{} `bson:"style,omitempty" json:"style,omitempty"`
}

type Role

type Role struct {
	ID          uint64    `json:"id"`
	Name        string    `gorm:"type:varchar;uniqueIndex;not null;comment:名称" json:"name"`
	Description string    `gorm:"type:varchar;comment:描述" json:"description"`
	Pages       RolePages `gorm:"type:jsonb;default:'{}';not null;comment:授权页面" json:"pages"`
	Status      bool      `gorm:"default:true;not null;comment:状态" json:"status"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
}

type RolePages

type RolePages map[string]int64

func (*RolePages) Scan

func (x *RolePages) Scan(value interface{}) error

func (RolePages) Value

func (x RolePages) Value() (driver.Value, error)

type Schema

type Schema struct {
	// 命名
	Key string `bson:"key" json:"key"`

	// 字段
	Fields []*SchemaField `bson:"fields" json:"fields"`

	// 显隐规则
	Rules []*SchemaRule `bson:"rules,omitempty" json:"rules,omitempty"`

	// 启用事务补偿
	Event *bool `bson:"event,omitempty" json:"event,omitempty"`

	// 启用详情
	Detail *bool `bson:"detail,omitempty" json:"detail,omitempty"`
}

type SchemaField

type SchemaField struct {
	// 命名
	Key string `bson:"key" json:"key"`

	// 显示名称
	Label string `bson:"label" json:"label"`

	// 字段类型
	Type string `bson:"type" json:"type"`

	// 字段描述
	Description string `bson:"description,omitempty" json:"description,omitempty"`

	// 字段提示
	Placeholder string `bson:"placeholder,omitempty" json:"placeholder,omitempty"`

	// 默认值
	Default interface{} `bson:"default,omitempty" json:"default,omitempty"`

	// 关键词
	Keyword *bool `bson:"keyword,omitempty" json:"keyword,omitempty"`

	// 是否必须
	Required *bool `bson:"required,omitempty" json:"required,omitempty"`

	// 隐藏字段
	Hide *bool `bson:"hide,omitempty" json:"hide,omitempty"`

	// 只读
	Readonly *bool `bson:"readonly,omitempty" json:"readonly,omitempty"`

	// 投影
	Projection *int64 `bson:"projection,omitempty" json:"projection,omitempty"`

	// 排序
	Sort *int64 `bson:"sort" json:"sort"`

	// 配置
	Option *SchemaFieldOption `bson:"option,omitempty" json:"option,omitempty"`
}

type SchemaFieldOption

type SchemaFieldOption struct {
	// 最大值
	Max int64 `bson:"max,omitempty" json:"max,omitempty"`

	// 最小值
	Min int64 `bson:"min,omitempty" json:"min,omitempty"`

	// 保留小数
	Decimal int64 `bson:"decimal,omitempty" json:"decimal,omitempty"`

	// 包含时间
	Time *bool `bson:"time,omitempty" json:"time,omitempty"`

	// 枚举数值
	Values []Value `bson:"values,omitempty" json:"values,omitempty"`

	// 引用类型,模型
	Reference string `bson:"reference,omitempty" json:"reference,omitempty"`

	// 引用类型,目标字段
	Target string `bson:"target,omitempty" json:"target,omitempty"`

	// 多选
	Multiple *bool `bson:"multiple,omitempty" json:"multiple,omitempty"`

	// 组件标识
	Component string `bson:"component,omitempty" json:"component,omitempty"`
}

type SchemaRule

type SchemaRule struct {
	// 逻辑
	Logic string `bson:"logic" json:"logic"`

	// 条件
	Conditions []*SchemaRuleCondition `bson:"conditions" json:"conditions"`

	// 显示字段
	Keys []string `bson:"keys" json:"keys"`
}

type SchemaRuleCondition

type SchemaRuleCondition struct {
	// 字段
	Key string `bson:"key" json:"key"`

	// 操作符
	Operate string `bson:"operate" json:"operate"`

	// 数值
	Value interface{} `bson:"value" json:"value"`
}

type Source

type Source struct {
	// 布局
	Layout string `bson:"layout" json:"layout"`

	// 图表
	Panels []*Panel `bson:"panels" json:"panels"`
}

type User

type User struct {
	ID primitive.ObjectID `bson:"_id,omitempty" json:"_id"`

	// 用户名
	Username string `bson:"username" json:"username"`

	// 密码
	Password string `bson:"password" json:"password,omitempty"`

	// 电子邮件
	Email string `bson:"email" json:"email"`

	// 所属部门
	Department *primitive.ObjectID `bson:"department" json:"-"`

	// 权限组
	Roles []primitive.ObjectID `bson:"roles" json:"roles,omitempty"`

	// 称呼
	Name string `bson:"name" json:"name"`

	// 头像
	Avatar string `bson:"avatar" json:"avatar"`

	// 登录次数
	Sessions int64 `bson:"sessions" json:"sessions"`

	// 最近登录记录
	Last string `json:"last" bson:"last"`

	// 飞书 OpenID
	Feishu bson.M `json:"feishu" bson:"feishu"`

	// 状态
	Status bool `bson:"status" json:"status"`

	// 标记
	Labels []string `bson:"labels" json:"labels"`

	// 创建时间
	CreateTime time.Time `bson:"create_time" json:"-"`

	// 更新时间
	UpdateTime time.Time `bson:"update_time" json:"-"`
}

func NewUser

func NewUser(username string, password string) *User

func (*User) SetEmail

func (x *User) SetEmail(v string) *User

func (*User) SetLabel

func (x *User) SetLabel(v string) *User

func (*User) SetRoles

func (x *User) SetRoles(v []primitive.ObjectID) *User

type Value

type Value struct {
	// 名称
	Label string `bson:"label" json:"label"`

	// 数值
	Value interface{} `bson:"value" json:"value"`
}

Jump to

Keyboard shortcuts

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