Help us shape the future of Go! Take the 2026 Go Developer Survey

model

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2022 License: BSD-3-Clause Imports: 3 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 primitive.ObjectID `bson:"_id,omitempty" json:"_id"`

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

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

	// 授权页面
	Pages map[string]*int64 `bson:"pages" json:"pages"`

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

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

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

func NewRole

func NewRole(name string) *Role

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"`

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

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

func NewUser

func NewUser(username string, password string) *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