spec

package
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2023 License: AGPL-3.0 Imports: 15 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MemCache = cache.NewMemCache("spec", 1000, 1000)

Functions

func Load

func Load()

func UploadExcel

func UploadExcel(filename string) error

Types

type AttributeSpecs

type AttributeSpecs []*entity.AttributeSpec

func (AttributeSpecs) Len

func (as AttributeSpecs) Len() int

func (AttributeSpecs) Less

func (as AttributeSpecs) Less(i, j int) bool

func (AttributeSpecs) Swap

func (as AttributeSpecs) Swap(i, j int)

type MetaDefinition

type MetaDefinition struct {
	RoleSpecs       []*entity.RoleSpec       `json:",omitempty"`
	AttributeSpecs  []*entity.AttributeSpec  `json:",omitempty"`
	ActionSpecs     []*entity.ActionSpec     `json:",omitempty"`
	FixedRoleSpecs  []*entity.FixedRoleSpec  `json:",omitempty"`
	ConnectionSpecs []*entity.ConnectionSpec `json:",omitempty"`
}

func GetMetaDefinition

func GetMetaDefinition() *MetaDefinition

func (*MetaDefinition) GetAttributeSpecEntity

func (md *MetaDefinition) GetAttributeSpecEntity(specId uint64, effectiveDate *time.Time) *entity.AttributeSpec

func (*MetaDefinition) GetChildrenAttributeSpec

func (md *MetaDefinition) GetChildrenAttributeSpec(specId uint64, effectiveDate *time.Time, dynamic bool) []*entity.AttributeSpec

* 返回动态属性或者静态属性

func (*MetaDefinition) GetConnection

func (md *MetaDefinition) GetConnection(specType string, parentId uint64, subId uint64, effectiveDate *time.Time) *entity.ConnectionSpec

func (*MetaDefinition) GetFixedAttributes

func (md *MetaDefinition) GetFixedAttributes(fixedSpecId uint64) map[string]string

返回缓存的字段名map,可用于判断字段是否存在

func (*MetaDefinition) GetFixedAttributesAlias

func (md *MetaDefinition) GetFixedAttributesAlias(fixedSpecId uint64, attributeSpec *entity.AttributeSpec) string

如果返回的alias不为空,说明这是静态属性,字段名就是返回的别名

func (*MetaDefinition) GetFixedRoleSpec

func (md *MetaDefinition) GetFixedRoleSpec(fixedSpecId uint64) *entity.FixedRoleSpec

func (*MetaDefinition) GetRoleSpec

func (md *MetaDefinition) GetRoleSpec(specId uint64, effectiveDate *time.Time) (*RoleSpec, *ModelSpec)

type ModelSpec

type ModelSpec struct {
	entity.RoleSpec
	Children        []*ModelSpec                        `json:"children,omitempty"`
	AttributeSpecs  []*entity.AttributeSpec             `json:",omitempty"`
	ActionSpecs     []*entity.ActionSpec                `json:",omitempty"`
	FixedRoleSpec   *entity.FixedRoleSpec               `json:",omitempty"`
	ConnectionSpecs map[string][]*entity.ConnectionSpec `json:",omitempty"`
	EffectiveDate   *time.Time
}

* 这个角色定义专用于与前端的交互

type RoleSpec

type RoleSpec struct {
	entity.RoleSpec
	RoleSpecs       map[uint64]*RoleSpec              `json:",omitempty"`
	AttributeSpecs  map[uint64]*entity.AttributeSpec  `json:",omitempty"`
	ActionSpecs     map[uint64]*entity.ActionSpec     `json:",omitempty"`
	FixedRoleSpec   *entity.FixedRoleSpec             `json:",omitempty"`
	FixedAttributes map[string]string                 `json:"-,omitempty"`
	ConnectionSpecs map[string]*entity.ConnectionSpec `json:",omitempty"`
	EffectiveDate   *time.Time
	Parent          *RoleSpec `json:"-,omitempty"`
	Path            string    `json:"-,omitempty"`
}

func (*RoleSpec) GetChildActionSpec

func (this *RoleSpec) GetChildActionSpec(kind string) *entity.ActionSpec

func (*RoleSpec) GetChildAttributeSpec

func (this *RoleSpec) GetChildAttributeSpec(kind string) *entity.AttributeSpec

func (*RoleSpec) GetChildConnectionSpec

func (this *RoleSpec) GetChildConnectionSpec(subSpecId uint64) *entity.ConnectionSpec

func (*RoleSpec) GetChildRoleSpec

func (this *RoleSpec) GetChildRoleSpec(kind string) *RoleSpec

func (*RoleSpec) GetFixedService

func (this *RoleSpec) GetFixedService() baseservice.BaseService

func (*RoleSpec) GetRoleSpecMap

func (this *RoleSpec) GetRoleSpecMap() map[uint64]*RoleSpec

func (*RoleSpec) GetSortedAttributeSpecs

func (this *RoleSpec) GetSortedAttributeSpecs(dynamic bool) []*entity.AttributeSpec

func (*RoleSpec) GetSortedRoleSpecs

func (this *RoleSpec) GetSortedRoleSpecs() []*RoleSpec

type RoleSpecs

type RoleSpecs []*RoleSpec

func (RoleSpecs) Len

func (as RoleSpecs) Len() int

func (RoleSpecs) Less

func (as RoleSpecs) Less(i, j int) bool

func (RoleSpecs) Swap

func (as RoleSpecs) Swap(i, j int)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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