domain

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MappingOneToOne   = "one_to_one"   // 一对一关系
	MappingOneToMany  = "one_to_many"  // 一对多关系
	MappingManyToMany = "many_to_many" // 多对多关系
)

Variables

This section is empty.

Functions

func ValidMapping

func ValidMapping(mapping string) bool

Types

type Attribute

type Attribute struct {
	ID        int64
	GroupId   int64
	ModelUid  string
	FieldUid  string
	FieldName string
	FieldType string
	Required  bool
	Display   bool
	Secure    bool
	Link      bool
	Index     int64
	SortKey   int64 // 拖拽排序键(稀疏索引)
	Option    interface{}
	Version   int64
	Builtin   bool
}

func (*Attribute) GetConstraintDescription

func (a *Attribute) GetConstraintDescription() string

GetConstraintDescription 获取字段约束描述 NOTE: 用于 Excel 模板的第三行表头

func (Attribute) GetID

func (a Attribute) GetID() int64

GetID 实现 Sortable 接口

func (*Attribute) GetOptionStrings

func (a *Attribute) GetOptionStrings() []string

GetOptionStrings 获取选项字符串列表 NOTE: 统一处理 []string、[]interface{}、primitive.A 等类型

func (Attribute) GetSortKey

func (a Attribute) GetSortKey() int64

GetSortKey 实现 Sortable 接口

func (*Attribute) IsSelectType

func (a *Attribute) IsSelectType() bool

IsSelectType 判断是否为选择类型字段 NOTE: select 和 list 类型需要下拉列表验证

func (*Attribute) NeedsValidation

func (a *Attribute) NeedsValidation() bool

NeedsValidation 判断是否需要数据验证

func (*Attribute) ToExcelRow

func (a *Attribute) ToExcelRow() []interface{}

ToExcelRow 转换为 Excel 行数据

func (Attribute) ValidateForCreate

func (a Attribute) ValidateForCreate() error

type AttributeGroup

type AttributeGroup struct {
	ID       int64
	Name     string
	ModelUid string
	SortKey  int64
}

func (AttributeGroup) GetID

func (ag AttributeGroup) GetID() int64

GetID 实现 Sortable 接口

func (AttributeGroup) GetSortKey

func (ag AttributeGroup) GetSortKey() int64

GetSortKey 实现 Sortable 接口

type AttributeGroupSortItem

type AttributeGroupSortItem struct {
	ID      int64
	SortKey int64
}

AttributeGroupSortItem 属性组排序更新项 NOTE: 用于批量更新时的数据传输

type AttributePipeline

type AttributePipeline struct {
	GroupId    int64       `bson:"_id"`
	Total      int         `bson:"total"`
	Attributes []Attribute `bson:"attributes"`
}

type AttributeSortItem

type AttributeSortItem struct {
	ID      int64
	GroupId int64
	SortKey int64
}

AttributeSortItem 属性排序更新项 NOTE: 用于批量更新时的数据传输

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

Builder Excel 构建器 NOTE: 封装 excelize,提供流式、声明式的 API

func NewBuilder

func NewBuilder(sheetName string) *Builder

NewBuilder 创建 Excel 构建器

func (*Builder) AddRow

func (b *Builder) AddRow(data ...interface{}) *Builder

AddRow 添加数据行

func (*Builder) AddRows

func (b *Builder) AddRows(rows [][]interface{}) *Builder

AddRows 批量添加数据行

func (*Builder) Build

func (b *Builder) Build() error

Build 构建 Excel 文件

func (*Builder) Close

func (b *Builder) Close() error

Close 关闭文件

func (*Builder) ToBytes

func (b *Builder) ToBytes() ([]byte, error)

ToBytes 导出为字节数组

func (*Builder) With3RowHeaders

func (b *Builder) With3RowHeaders(row1, row2, row3 []string) *Builder

With3RowHeaders 设置 3 行表头 row1: 字段 UID, row2: 字段名称, row3: 字段约束

func (*Builder) WithColumnWidths

func (b *Builder) WithColumnWidths(widths map[int]float64) *Builder

WithColumnWidths 设置列宽

func (*Builder) WithHeaders

func (b *Builder) WithHeaders(headers ...string) *Builder

WithHeaders 设置单行表头

func (*Builder) WithStyle

func (b *Builder) WithStyle(style *StyleSet) *Builder

WithStyle 设置样式

func (*Builder) WithValidation

func (b *Builder) WithValidation(colIdx int, options []string, startRow, endRow int) *Builder

WithValidation 添加数据验证

type Condition

type Condition struct {
	Name      string `json:"name"`      // 过滤名称
	Condition string `json:"condition"` // 过滤条件
	Input     string `json:"input"`     // 过滤输入
}

type EnumOption

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

type FieldDelete

type FieldDelete struct {
	ModelUid    string `json:"model_uid"`    // 模型唯一标识
	FieldUid    string `json:"field_uid"`    // 字段唯一标识
	TriggerTime int64  `json:"trigger_time"` // 触发时间
}

type FieldSecureAttrChange

type FieldSecureAttrChange struct {
	ModelUid   string `json:"model_uid"` // 模型唯一标识
	FieldUid   string `json:"field_uid"` // 模型字段唯一标识
	Secure     bool   `json:"secure"`    // 安全字段修改状态
	TiggerTime int64  `json:"ctime"`     // 触发时间
}

type FilterCondition

type FilterCondition struct {
	FieldUID string      `json:"field_uid"`
	Operator Operator    `json:"operator"`
	Value    interface{} `json:"value"`
}

FilterCondition 筛选条件

type FilterGroup

type FilterGroup struct {
	Filters []FilterCondition `json:"filters"`
}

FilterGroup 筛选条件组 (组内 AND)

type Model

type Model struct {
	ID      int64
	GroupId int64
	Name    string
	UID     string
	Icon    string
	Builtin bool
	Ctime   time.Time
	Utime   time.Time
}

func (*Model) EnsureDeletable

func (m *Model) EnsureDeletable() error

EnsureDeletable 校验模型是否允许删除 NOTE: 内置模型禁止删除,将此业务规则内聚到领域对象

func (*Model) SheetName

func (m *Model) SheetName() string

type ModelDiagram

type ModelDiagram struct {
	ID              int64
	RelationTypeUid string
	TargetModelUid  string
	SourceModelUid  string
}

ModelDiagram 拓补图模型关联节点信息

type ModelGroup

type ModelGroup struct {
	ID   int64
	Name string
}

type ModelRelation

type ModelRelation struct {
	ID              int64
	SourceModelUID  string
	TargetModelUID  string
	RelationTypeUID string // 关联类型唯一索引
	RelationName    string // 拼接字符
	Mapping         string // 关联关系
	Ctime           time.Time
	Utime           time.Time
}

func (*ModelRelation) BelongsTo

func (m *ModelRelation) BelongsTo(modelUid string) bool

BelongsTo 判定指定的 modelUid 是否参与了该关系定义

func (*ModelRelation) IsSource

func (m *ModelRelation) IsSource(modelUid string) bool

IsSource 判定指定的 modelUid 是否为该关系定义的源端

func (*ModelRelation) IsTarget

func (m *ModelRelation) IsTarget(modelUid string) bool

IsTarget 判定指定的 modelUid 是否为该关系定义的目标端

func (*ModelRelation) RM

func (m *ModelRelation) RM() string

func (*ModelRelation) Validate

func (m *ModelRelation) Validate() error

Validate 校验模型关联定义本身的合法性并自我补齐关联名

type Operator

type Operator string

Operator 导出操作符枚举

const (
	OperatorEq       Operator = "eq"
	OperatorNe       Operator = "ne"
	OperatorContains Operator = "contains"
	OperatorGt       Operator = "gt"
	OperatorLt       Operator = "lt"
)

type Plugin

type Plugin = plugin.Plugin

type PluginActionSpec

type PluginActionSpec = plugin.ActionSpec

type PluginBinding

type PluginBinding = plugin.Binding

type PluginBindingDetail

type PluginBindingDetail struct {
	ID        int64                 `json:"id"`
	UID       string                `json:"uid"`
	PluginID  string                `json:"plugin_id"`
	ModelUID  string                `json:"model_uid"`
	ModelName string                `json:"model_name,omitempty"`
	GroupName string                `json:"group_name,omitempty"`
	ModelIcon string                `json:"model_icon,omitempty"`
	Enabled   bool                  `json:"enabled"`
	Graph     *pluginx.BindingGraph `json:"graph,omitempty"`
}

type PluginBoundModel

type PluginBoundModel struct {
	UID       string `json:"uid"`
	Name      string `json:"name"`
	GroupName string `json:"group_name,omitempty"`
	Icon      string `json:"icon,omitempty"`
	Builtin   bool   `json:"builtin"`
}

type PluginDetail

type PluginDetail struct {
	Plugin   pluginx.Plugin        `json:"plugin"`
	Bindings []PluginBindingDetail `json:"bindings"`
}

type PluginFilter

type PluginFilter = plugin.Filter

type PluginListItem

type PluginListItem struct {
	ID           int64                `json:"id"`
	UID          string               `json:"uid"`
	Name         string               `json:"name"`
	Type         string               `json:"type"`
	Version      string               `json:"version"`
	ActionCount  int                  `json:"action_count"`
	BindingCount int                  `json:"binding_count"`
	BoundModels  []PluginBoundModel   `json:"bound_models"`
	Actions      []pluginx.ActionSpec `json:"actions"`
	UpdatedAt    int64                `json:"updated_at"`
}

type PluginManagementEnums

type PluginManagementEnums struct {
	Types         []string        `json:"types"`
	Placements    []EnumOption    `json:"placements"`
	Directions    []EnumOption    `json:"directions"`
	RelationTypes []EnumOption    `json:"relation_types"`
	Cardinalities []EnumOption    `json:"cardinalities"`
	Mappings      []EnumOption    `json:"mappings"`
	Models        []PluginModelVM `json:"models"`
}

type PluginModelVM

type PluginModelVM struct {
	UID       string `json:"uid"`
	Name      string `json:"name"`
	GroupName string `json:"group_name,omitempty"`
	Icon      string `json:"icon,omitempty"`
	Builtin   bool   `json:"builtin"`
}

type PluginResolvedInput

type PluginResolvedInput = plugin.ResolvedInput

type PluginResolvedResource

type PluginResolvedResource = plugin.ResolvedResource

type PluginResourceAction

type PluginResourceAction = plugin.ResourceAction

type PluginResourceSpec

type PluginResourceSpec = plugin.ResourceSpec

type RelationType

type RelationType struct {
	ID             int64
	Name           string
	UID            string
	SourceDescribe string
	TargetDescribe string
	Ctime          time.Time
	Utime          time.Time
}

func (*RelationType) Validate

func (r *RelationType) Validate() error

Validate 校验关联类型定义合法性

type Resource

type Resource struct {
	ID       int64         `json:"id"`
	Name     string        `json:"name"`
	ModelUID string        `json:"model_uid"`
	Data     mongox.MapStr `json:"data"`
}

type ResourceAggregatedAssets

type ResourceAggregatedAssets struct {
	RelationName string
	ModelUid     string
	Total        int
	ResourceIds  []int64
}

type ResourceDiagram

type ResourceDiagram struct {
	SRC []ResourceRelation
	DST []ResourceRelation
}

type ResourceRelation

type ResourceRelation struct {
	ID               int64
	SourceModelUID   string
	TargetModelUID   string
	SourceResourceID int64
	TargetResourceID int64
	RelationTypeUID  string // 关联类型唯一索引
	RelationName     string // 拼接字符
}

func (*ResourceRelation) ValidateAndComplete

func (r *ResourceRelation) ValidateAndComplete(mr ModelRelation) error

ValidateAndComplete 传入对应的模型拓扑关系定义,让资源关系领域对象进行自我校验与补全

type SavePluginBindings

type SavePluginBindings struct {
	PluginID string
	Bindings []pluginx.Binding
}

type SearchResource

type SearchResource struct {
	ModelUid string
	Total    int `json:"total"`
	Data     []mongox.MapStr
}

type StyleSet

type StyleSet struct {
	Header  int // 第一行表头样式 (属性/约束)
	Header2 int // 第二行表头样式 (UID)
	Header3 int // 第三行表头样式 (名称)
	OddRow  int // 奇数行样式
	EvenRow int // 偶数行样式
}

StyleSet Excel 样式集

Jump to

Keyboard shortcuts

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