Documentation
¶
Index ¶
- Variables
- func ParseAttrTag(tag string) (name string, options types.Strings)
- func RegisterAtomicAttrType(data any)
- func RegisterData2Attr[T any](fn func(data T) *Attribute)
- func RegisterData2AttrTypeless(typ reflect.Type, fn func(data any) *Attribute)
- func RegisterData2Attrs[T any](fn func(data T) Attributes)
- func RegisterData2AttrsTypeless(t reflect.Type, fn func(data any) Attributes)
- type Attribute
- type AttributeMeta
- type AttributeMetaPtr
- type AttributeMetas
- type AttributePtr
- type Attributes
- func (attrs Attributes) AppendFromData(prefix string, data any) Attributes
- func (attrs Attributes) AppendFromListValue(prefix string, value reflect.Value) Attributes
- func (attrs Attributes) AppendFromMapValue(prefix string, value reflect.Value) Attributes
- func (attrs Attributes) AppendFromPointerValue(prefix string, value reflect.Value) Attributes
- func (attrs Attributes) AppendFromStructValue(prefix string, value reflect.Value) Attributes
- func (attrs Attributes) AppendFromValue(prefix string, value reflect.Value) Attributes
- func (attrs Attributes) Print()
- func (attrs Attributes) SortByName() Attributes
- func (attrs Attributes) WithNamePrefix(prefix string) Attributes
- type CommonMetaModel
- type CommonModel
- type Domain
- type Entity
- type EntityAttribute
- type EntityAttributePtr
- type EntityAttributes
- type EntityMeta
- type Relation
- type RelationMeta
- type RelationMetas
Constants ¶
This section is empty.
Variables ¶
View Source
var (
IndexPattern = regexp.MustCompile(`\[(\d+)\]`)
)
Functions ¶
func RegisterAtomicAttrType ¶ added in v1.0.92
func RegisterAtomicAttrType(data any)
func RegisterData2Attr ¶ added in v1.0.92
func RegisterData2AttrTypeless ¶ added in v1.0.92
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) WithNamePrefix ¶ added in v1.0.92
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 CommonModel ¶
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
Click to show internal directories.
Click to hide internal directories.