entity

package
v1.1.16 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	IndexPattern = regexp.MustCompile(`\[(\d+)\]`)
)

Functions

func ParseAttrTag

func ParseAttrTag(tag string) (name string, options types.Strings)

func RegisterAtomicAttrType added in v1.0.92

func RegisterAtomicAttrType(data any)

func RegisterData2Attr added in v1.0.92

func RegisterData2Attr[T any](fn func(data T) *Attribute)

func RegisterData2AttrTypeless added in v1.0.92

func RegisterData2AttrTypeless(typ reflect.Type, fn func(data any) *Attribute)

func RegisterData2Attrs added in v1.0.92

func RegisterData2Attrs[T any](fn func(data T) Attributes)

func RegisterData2AttrsTypeless added in v1.0.92

func RegisterData2AttrsTypeless(t reflect.Type, fn func(data any) Attributes)

Types

type Attribute

type Attribute struct {
	Name  string `bson:"Name" json:"Name"`
	Value any    `bson:"Value" json:"Value"`
}

func (*Attribute) GetName

func (attr *Attribute) GetName() string

func (*Attribute) GetValue

func (attr *Attribute) GetValue() any

func (*Attribute) Print

func (attr *Attribute) Print()

func (*Attribute) String

func (attr *Attribute) String() string

func (*Attribute) WithNamePrefix added in v1.0.92

func (attr *Attribute) WithNamePrefix(prefix string) *Attribute

type AttributeMeta

type AttributeMeta struct {
	CommonMetaModel `bson:",inline" json:",inline"`

	// 参数类型
	Type string `bson:"Type" json:"Type"`

	Required   bool `bson:"Required" json:"Required"`     // 是否必填
	Searchable bool `bson:"Searchable" json:"Searchable"` // 是否可搜索
	Vectorized bool `bson:"Vectorized" json:"Vectorized"` // 是否已向量化
}

type AttributeMetaPtr

type AttributeMetaPtr = *AttributeMeta

type AttributeMetas

type AttributeMetas []*AttributeMeta

type AttributePtr

type AttributePtr = *Attribute

type Attributes

type Attributes []*Attribute

func FlattenDataAttributes

func FlattenDataAttributes(data any) Attributes

FlattenDataAttributes 将嵌套数据转换为扁平的属性列表 支持多层嵌套的 slice/array/map/struct 格式示例:

  • name1.name2.name3: value (嵌套 map)
  • name1.name2[0].name3: value (包含数组)

func NewAttributes

func NewAttributes(attrs ...*Attribute) Attributes

func (Attributes) AppendFromData

func (attrs Attributes) AppendFromData(prefix string, data any) Attributes

func (Attributes) AppendFromListValue

func (attrs Attributes) AppendFromListValue(prefix string, value reflect.Value) Attributes

func (Attributes) AppendFromMapValue

func (attrs Attributes) AppendFromMapValue(prefix string, value reflect.Value) Attributes

func (Attributes) AppendFromPointerValue

func (attrs Attributes) AppendFromPointerValue(prefix string, value reflect.Value) Attributes

func (Attributes) AppendFromStructValue

func (attrs Attributes) AppendFromStructValue(prefix string, value reflect.Value) Attributes

func (Attributes) AppendFromValue

func (attrs Attributes) AppendFromValue(prefix string, value reflect.Value) Attributes

func (Attributes) Print

func (attrs Attributes) Print()

func (Attributes) SortByName

func (attrs Attributes) SortByName() Attributes

func (Attributes) WithNamePrefix added in v1.0.92

func (attrs Attributes) WithNamePrefix(prefix string) Attributes

type CommonMetaModel

type CommonMetaModel struct {
	Name  string `bson:"Name" json:"Name"`
	Title string `bson:"Title" json:"Title"`
	Desc  string `bson:"Desc" json:"Desc"`
}

type CommonModel

type CommonModel struct {
	CreatedTime      time.Time `bson:"CreatedTime" json:"CreatedTime"`
	LastModifiedTime time.Time `bson:"LastModifiedTime" json:"LastModifiedTime"`

	Deleted bool `bson:"Deleted" json:"Deleted"`
}

type Domain

type Domain struct {
	Name  string `bson:"Name" json:"Name"`
	Title string `bson:"Title" json:"Title"`
	Desc  string `bson:"Desc" json:"Desc"`

	CreatedTime      time.Time `bson:"CreatedTime" json:"CreatedTime"`           // 创建时间
	LastModifiedTime time.Time `bson:"LastModifiedTime" json:"LastModifiedTime"` // 最近修改时间

	Deleted bool `bson:"Deleted" json:"Deleted"` // 是否删除
}

type Entity

type Entity struct {
	// 实例ID
	InstanceId string `bson:"InstanceId" json:"InstanceId"`

	// 实体元数据
	MetaName string      `bson:"MetaName" json:"MetaName"`
	Meta     *EntityMeta `bson:"-" json:"Meta"`

	// 属性列表
	Attributes Attributes `bson:"Attributes" json:"Attributes"`

	SearchableText string `bson:"SearchableText" json:"SearchableText"`

	CreatedTime      time.Time `bson:"CreatedTime" json:"CreatedTime"`           // 创建时间
	LastModifiedTime time.Time `bson:"LastModifiedTime" json:"LastModifiedTime"` // 最近修改时间

	Deleted bool `bson:"Deleted" json:"Deleted"` // 是否删除
}

type EntityAttribute

type EntityAttribute = Attribute

type EntityAttributePtr

type EntityAttributePtr = AttributePtr

type EntityAttributes

type EntityAttributes = Attributes

type EntityMeta

type EntityMeta struct {
	Name  string `bson:"Name" json:"Name"`
	Title string `bson:"Title" json:"Title"`
	Desc  string `bson:"Desc" json:"Desc"`

	Attributes AttributeMetas `bson:"Attributes" json:"Attributes"`

	CreatedTime      time.Time `bson:"CreatedTime" json:"CreatedTime"`           // 创建时间
	LastModifiedTime time.Time `bson:"LastModifiedTime" json:"LastModifiedTime"` // 最近修改时间

	Deleted bool `bson:"Deleted" json:"Deleted"` // 是否删除
}

type Relation

type Relation struct {
	// 实例ID
	InstanceId string `bson:"InstanceId" json:"InstanceId"`

	// 关系元数据
	MetaName string        `bson:"MetaName" json:"MetaName"`
	Meta     *RelationMeta `bson:"-" json:"Meta"`

	CreatedTime      time.Time `bson:"CreatedTime" json:"CreatedTime"`           // 创建时间
	LastModifiedTime time.Time `bson:"LastModifiedTime" json:"LastModifiedTime"` // 最近修改时间

	Deleted bool `bson:"Deleted" json:"Deleted"` // 是否删除
}

type RelationMeta

type RelationMeta struct {
	Name  string `bson:"Name" json:"Name"`
	Title string `bson:"Title" json:"Title"`
	Desc  string `bson:"Desc" json:"Desc"`

	CreatedTime      time.Time `bson:"CreatedTime" json:"CreatedTime"`           // 创建时间
	LastModifiedTime time.Time `bson:"LastModifiedTime" json:"LastModifiedTime"` // 最近修改时间

	Deleted bool `bson:"Deleted" json:"Deleted"` // 是否删除
}

type RelationMetas

type RelationMetas []*RelationMeta

Jump to

Keyboard shortcuts

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