Documentation
¶
Index ¶
Constants ¶
View Source
const (
APP_NAME = "lable"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateCreateLabelSpec ¶
type CreateCreateLabelSpec struct { // 适用于那些资源 Resources []string `` /* 136-byte string literal not displayed */ // 标签的键 Key string `json:"key" bson:"key" gorm:"column:key;type:varchar(255)" validate:"required"` // 标签的键的描述 KeyDesc string `json:"key_desc" bson:"key_desc" gorm:"column:key_desc;type:varchar(255)" validate:"required"` // 标签的颜色 Color string `json:"color" bson:"color" gorm:"column:color;type:varchar(100)"` // 值类型, 支持树状 ValueType VALUE_TYPE `json:"value_type" gorm:"column:value_type;type:varchar(20)" bson:"value_type"` // 标签默认值 DefaultValue string `json:"default_value" gorm:"column:default_value;type:text" bson:"default_value"` // 值描述 ValueDesc string `json:"value_desc" gorm:"column:value_desc;type:text" bson:"value_desc"` // 是否是多选 Multiple bool `json:"multiple" bson:"multiple" gorm:"column:multiple;tinyint(1)"` // 枚举值的选项 EnumOptions []*EnumOption `json:"enum_options,omitempty" bson:"enum_options" gorm:"column:enum_options;type:json;serializer:json;"` // 基于Http枚举的配置 HttpEnumConfig HttpEnumConfig `json:"http_enum_config" gorm:"embedded" bson:"http_enum_config"` // 值的样例 Example string `json:"example" bson:"example" gorm:"column:example;type:text"` // 扩展属性 Extras map[string]string `json:"extras" bson:"extras" gorm:"column:extras;type:json;serializer:json;"` }
type CreateLabelRequest ¶
type CreateLabelRequest struct { // 创建人 CreateBy string `json:"create_by" bson:"create_by" gorm:"column:create_by;type:varchar(255)"` // 标签的键 Domain string `json:"domain" bson:"domain" gorm:"column:domain;type:varchar(100)"` // 标签的键 Namespace string `json:"namespace" bson:"namespace" gorm:"column:namespace;type:varchar(100)"` // 用户参数 CreateCreateLabelSpec }
func NewCreateLabelRequest ¶
func NewCreateLabelRequest() *CreateLabelRequest
func (*CreateLabelRequest) AddEnumOption ¶
func (r *CreateLabelRequest) AddEnumOption(enums ...*EnumOption) *CreateLabelRequest
func (*CreateLabelRequest) Validate ¶
func (r *CreateLabelRequest) Validate() error
type DeleteLabelRequest ¶
type DeleteLabelRequest struct {
DescribeLabelRequest
}
type DescribeLabelRequest ¶
type DescribeLabelRequest struct { // 标签Id Id string `json:"id"` }
type EnumOption ¶
type EnumOption struct { // 选项的说明 Label string `json:"label" bson:"label"` // 用户输入 Input string `json:"input" bson:"input" validate:"required"` // 选项的值, 根据parent.input + children.input 自动生成 Value string `json:"value" bson:"value"` // 是否禁止选中, 和前端UI组件配合使用 Disabled bool `json:"disabled" bson:"disabled"` // 标签的颜色 Color string `json:"color" bson:"color"` // 是否废弃 Deprecate bool `json:"deprecate" bson:"deprecate"` // 废弃说明 DeprecateDesc string `json:"deprecate_desc" bson:"deprecate_desc"` // 枚举的子选项 Children []*EnumOption `json:"children,omitempty" bson:"children"` // 扩展属性 Extensions map[string]string `json:"extensions" bson:"extensions"` }
type HttpEnumConfig ¶
type HttpEnumConfig struct { // 基于枚举的URL, 注意只支持Get方法 Url string `json:"url" bson:"url" gorm:"column:http_enum_config_url;type:text"` // Enum Label映射的字段名 KeyFiled string `json:"enum_label_name" bson:"enum_label_name" gorm:"column:http_enum_config_key_filed;type:varchar(100)"` // Enum Value映射的字段名 ValueFiled string `json:"enum_label_value" bson:"enum_label_value" gorm:"column:http_enum_config_value_filed;type:varchar(100)"` }
type Label ¶
type Label struct { // 基础数据 apps.ResourceMeta // 空间定义 CreateLabelRequest `bson:",inline" gorm:"embedded"` }
func NewLabel ¶
func NewLabel(spc *CreateLabelRequest) (*Label, error)
type QueryLabelRequest ¶
type QueryLabelRequest struct {
*request.PageRequest
}
func NewQueryLabelRequest ¶
func NewQueryLabelRequest() *QueryLabelRequest
type Service ¶
type Service interface { // 创建标签 CreateLabel(context.Context, *CreateLabelRequest) (*Label, error) // 修改标签 UpdateLabel(context.Context, *UpdateLabelRequest) (*Label, error) // 删除标签 DeleteLabel(context.Context, *DeleteLabelRequest) (*Label, error) // 查询标签列表 QueryLabel(context.Context, *QueryLabelRequest) (*types.Set[*Label], error) // 查询标签列表 DescribeLabel(context.Context, *DescribeLabelRequest) (*Label, error) }
func GetService ¶
func GetService() Service
type UpdateLabelRequest ¶
type UpdateLabelRequest struct { DescribeLabelRequest // 更新人 UpdateBy string `json:"update_by"` // 标签信息 Spec *CreateLabelRequest `json:"spec"` }
type VALUE_TYPE ¶
type VALUE_TYPE string
值类型
const ( // 文本 VALUE_TYPE_TEXT VALUE_TYPE = "text" // 布尔值, 只能是ture或者false VALUE_TYPE_BOOLEAN VALUE_TYPE = "bool" // 枚举 VALUE_TYPE_ENUM VALUE_TYPE = "enum" // 基于url的远程选项拉去, 仅存储URL地址, 前端自己处理 VALUE_TYPE_HTTP_ENUM VALUE_TYPE = "http_enum" )
Click to show internal directories.
Click to hide internal directories.