Documentation
¶
Index ¶
- Constants
- Variables
- func ArgNotEmpty(arg interface{}) bool
- func ArgToString(arg interface{}) string
- func ArgsAllEmpty(args []interface{}) bool
- func ArgsMapToStrings(sep string, args map[string]interface{}) string
- func ArgsSliceToString(sep string, args []interface{}) string
- func ArgsSliceToStrings(args []interface{}) []string
- func ArgsToString(sep string, args ...interface{}) string
- func ArgsToStrings(args ...interface{}) []string
- func JSONCamelCase(s string) string
- func JSONSnakeCase(s string) string
- type Alias
- type DbStorage
- type Definition
- type Entities
- type Entity
- func (entity *Entity) AddPkFieldsToMap(fieldsMap *FieldsMap)
- func (entity *Entity) AddSystemFieldsToMap(fieldsMap *FieldsMap)
- func (entity *Entity) AssociationMap() FieldsMap
- func (entity *Entity) CacheInvalidValuePtr(structPtrValue reflect.Value) (invalid bool, err error)
- func (entity *Entity) CompositionMap() FieldsMap
- func (entity *Entity) CopyMapToStruct(fromMapInterface interface{}, toRow *Object, outFields FieldsMap) (empty bool, err error)
- func (entity *Entity) CopyObjectSlice(fromSlice *Object, toSlice *Object, outFields FieldsMap) (err error)
- func (entity *Entity) CopyObjectStruct(fromStruct *Object, toStruct *Object, outFields FieldsMap) (err error)
- func (entity *Entity) CopySlicePtrByFieldName(fromPtr interface{}, toPtr interface{}, outFields FieldsMap) (err error)
- func (entity *Entity) CopyStructPtrByFieldName(fromPtr interface{}, toPtr interface{}, outFields FieldsMap) (err error)
- func (entity *Entity) DefTypeCacheKey() string
- func (entity *Entity) DefTypeCacheKeyEmptyRef() string
- func (entity *Entity) DefTypeCacheKeyEmptyTag() string
- func (entity *Entity) ExprsByAction(action ExprAction) *Exprs
- func (entity *Entity) FieldByName(name string) *Field
- func (entity *Entity) FieldByTagName(format, tag string) *Field
- func (entity *Entity) FieldDisplayName(name string) string
- func (entity *Entity) FieldFullName(name string) string
- func (entity *Entity) FieldRV(field *Field, row *Object) (value reflect.Value, err error)
- func (entity *Entity) FieldValue(field *Field, row *Object) (value interface{}, err error)
- func (entity *Entity) FieldValuePtr(field *Field, structPtrValue reflect.Value) (value reflect.Value, err error)
- func (entity *Entity) FieldsExprs() Exprs
- func (entity *Entity) FieldsExprsByAction(action ExprAction) *Exprs
- func (entity *Entity) FieldsMap() FieldsMap
- func (entity *Entity) FieldsRV(fields Fields, row *Object) (values []reflect.Value, err error)
- func (entity *Entity) FieldsValue(fields Fields, row *Object) (values []interface{}, err error)
- func (entity *Entity) FieldsValuePtr(fields Fields, structPtrValue reflect.Value) (values []interface{}, err error)
- func (entity *Entity) GetAssociation(name string) *Reference
- func (entity *Entity) GetComposition(name string) *Reference
- func (entity *Entity) GetErrors() *Field
- func (entity *Entity) GetTag(format string, useNameAsDefault bool) string
- func (entity *Entity) GetTagName(format string, useNameAsDefault bool) string
- func (entity *Entity) GetXMLName() *Field
- func (entity *Entity) GetXmlNameFromTag(useNameAsDefault bool) *xml.Name
- func (entity *Entity) HasAssociations() bool
- func (entity *Entity) HasCompositions() bool
- func (entity *Entity) KeyByName(name string) *Key
- func (entity *Entity) KeyFieldsRV(key *Key, row *Object) (values []reflect.Value, err error)
- func (entity *Entity) KeyFieldsValue(key *Key, row *Object) (values []interface{}, err error)
- func (entity *Entity) KeyFieldsValuePtr(key *Key, structPtrValue reflect.Value) (values []interface{}, err error)
- func (entity *Entity) Keys() Keys
- func (entity *Entity) NewSlice(fields FieldsMap, typeCacheKey string, len, cap int) (cacheHit bool, slice *Object, err error)
- func (entity *Entity) NewStruct(fields FieldsMap, typeCacheKey string) (cacheHit bool, row *Object, err error)
- func (entity *Entity) PKFieldsName() []string
- func (entity *Entity) PKKey() *Key
- func (entity *Entity) ReferenceByName(name string) *Reference
- func (entity *Entity) ReferenceFieldsValue(reference *Reference, row *Object) (values []interface{}, err error)
- func (entity *Entity) ReferenceFieldsValuePtr(reference *Reference, structPtrValue reflect.Value) (values []interface{}, err error)
- func (entity *Entity) References() References
- func (entity *Entity) SetCacheInvalidValuePtr(structPtrValue reflect.Value, invalid bool) (err error)
- func (entity *Entity) SetErrorValue(row *Object, errors _err.Errors) (err error)
- func (entity *Entity) SetErrorValuePtr(structPtrValue reflect.Value, errors _err.Errors) (err error)
- func (entity *Entity) SetFieldRV(field *Field, row *Object, inRV reflect.Value) (err error)
- func (entity *Entity) SetFieldValuePtr(field *Field, structPtrValue reflect.Value, val reflect.Value) (err error)
- func (entity *Entity) SetTypeCache(key string, inRowType reflect.Type) (typeCacheEntry *TypeCacheEntry)
- func (entity *Entity) SetXmlNameValue(row *Object, xmlName *xml.Name) (err error)
- func (entity *Entity) SetXmlNameValueFromTag(row *Object) (err error)
- func (entity *Entity) SetXmlNameValueFromTagSlice(slice *Object) (err error)
- func (entity *Entity) SetXmlNameValuePtr(structPtrValue reflect.Value, xmlName *xml.Name) (err error)
- func (entity *Entity) SetXmlNameValuePtrFromTag(structPtrValue reflect.Value) (err error)
- func (entity *Entity) SetXmlNameValuePtrFromTagSlice(slicePtrValue reflect.Value) (err error)
- func (entity *Entity) SetXmlNameValueSlice(slice *Object, xmlName *xml.Name) (err error)
- func (entity *Entity) StructFields() Fields
- func (entity *Entity) StructFieldsMap() FieldsMap
- func (entity *Entity) StructOf(restrictFields FieldsMap, ...) (structType reflect.Type, err error)
- func (entity *Entity) TypeCache(key string) (*TypeCacheEntry, bool)
- func (entity *Entity) TypeCacheKey(prefix string, fields FieldsMap) string
- func (entity *Entity) ValidationRules() map[string]string
- func (entity *Entity) ValidationRulesType() (map[string]string, interface{})
- func (entity *Entity) ZeroFieldRV(field *Field, row *Object) (err error)
- type EntityMap
- func (ent EntityMap) Delete(entityName string)
- func (ent EntityMap) GetDisplayName(entityName string) string
- func (ent EntityMap) GetEntity(entityName string) *Entity
- func (ent EntityMap) GetEntitySafe(entityName string) *Entity
- func (ent EntityMap) GetFieldDisplayName(entityName string, fieldName string) string
- func (ent EntityMap) GetFieldFullName(entityName string, fieldName string) string
- func (ent EntityMap) GetFullName(entityName string) string
- func (ent EntityMap) Set(entityName string, entity *Entity)
- type Expr
- func (ex *Expr) ArgsFields() Fields
- func (ex *Expr) CalculateField(externalId uint64, row *Object, exprVm *vm.VM) (output interface{}, err error)
- func (ex *Expr) CheckAction(action ExprAction) bool
- func (ex *Expr) Convert(externalId uint64, rowIn *Object, rowOut *Object, exprVm *vm.VM) (output interface{}, err error)
- func (ex *Expr) CopyField(externalId uint64, rowIn *Object, rowOut *Object, exprVm *vm.VM) (output interface{}, err error)
- func (ex *Expr) DestFields() Fields
- func (ex *Expr) Entity() *Entity
- func (ex *Expr) Field() *Field
- func (ex *Expr) FilterSlice(externalId uint64, rows *Object, exprVm *vm.VM) (output interface{}, err error)
- func (ex *Expr) FilterSliceFromStructField(externalId uint64, row *Object, exprVm *vm.VM) (output interface{}, err error)
- func (ex *Expr) IsInit() bool
- func (ex *Expr) Run(externalId uint64, env interface{}, exprVm *vm.VM) (output interface{}, err error)
- type ExprAction
- type ExprType
- type Exprs
- type ExprsByAction
- type Field
- func (field *Field) CheckFieldReference() error
- func (field *Field) Entity() *Entity
- func (field *Field) GetTag(format string, useNameAsDefault bool) string
- func (field *Field) GetTagName(format string, useNameAsDefault bool) string
- func (field *Field) GetXmlNameFromTag(useNameAsDefault bool) *xml.Name
- func (field *Field) Index(t reflect.Type) []int
- func (field *Field) Reference() *Reference
- func (field *Field) References() References
- func (field *Field) ReflectType() reflect.Type
- type FieldNumber
- type Fields
- type FieldsMap
- func (fieldsMap FieldsMap) Copy() FieldsMap
- func (fieldsMap FieldsMap) Get(name string) *Field
- func (fieldsMap FieldsMap) GetDisplayName(fieldName string) string
- func (fieldsMap FieldsMap) GetFullName(fieldName string) string
- func (fieldsMap FieldsMap) GetValidationRules() map[string]string
- func (fieldsMap FieldsMap) Merge(fieldsMap2 FieldsMap) FieldsMap
- func (fieldsMap FieldsMap) String() string
- type FieldsV2
- type GlobalOptions
- type Key
- type KeyType
- type Keys
- type KeysMap
- type Meta
- func (meta *Meta) Backup() *Meta
- func (meta *Meta) GetDisplayName(entityName string) string
- func (meta *Meta) GetEntity(entityName string) *Entity
- func (meta *Meta) GetEntitySafe(entityName string) *Entity
- func (meta *Meta) GetEntityUnsafe(entityName string) *Entity
- func (meta *Meta) GetFieldDisplayName(entityName string, fieldName string) string
- func (meta *Meta) GetFieldFullName(entityName string, fieldName string) string
- func (meta *Meta) GetFullName(entityName string) string
- func (meta *Meta) Init() error
- func (meta *Meta) InitUnsafe() error
- func (meta *Meta) Lock()
- func (meta *Meta) RLock()
- func (meta *Meta) RUnlock()
- func (meta *Meta) Restore(copyMeta *Meta)
- func (meta *Meta) Set(entity *Entity, doReplace bool, doInit bool) error
- func (meta *Meta) SetEntityFromDefinitionUnsafe(definition *Definition, doReplace bool, doInit bool) (*Entity, error)
- func (meta *Meta) Unlock()
- type Modify
- type Name
- type Object
- func (o *Object) AppendObject(obj *Object)
- func (o *Object) CacheInvalid() bool
- func (o *Object) ClearObjects()
- func (o *Object) Copy(copyAssociation bool, copyComposition bool) *Object
- func (o *Object) CopyAssociationFrom(from *Object)
- func (o *Object) CopyCompositionFrom(from *Object)
- func (o *Object) FieldRV(field *Field) (value reflect.Value, err error)
- func (o *Object) FieldValue(field *Field) (value interface{}, err error)
- func (o *Object) FieldsRV(fields Fields) (values []reflect.Value, err error)
- func (o *Object) FieldsValue(fields Fields) (values []interface{}, err error)
- func (o *Object) KeyFieldsRV(key *Key) (values []reflect.Value, err error)
- func (o *Object) KeyFieldsValue(key *Key) (values []interface{}, err error)
- func (o *Object) KeyValue(key *Key) []interface{}
- func (o *Object) KeyValueString(key *Key) string
- func (o *Object) KeysValueString() string
- func (o *Object) Lock()
- func (o *Object) NewFromRV(rv reflect.Value, isSlice bool) *Object
- func (o *Object) PKKey() *Key
- func (o *Object) PKValue() []interface{}
- func (o *Object) RLock()
- func (o *Object) RUnlock()
- func (o *Object) ReferenceFieldsValue(reference *Reference) (values []interface{}, err error)
- func (o *Object) SetAssociationUnsafe(field *Field, obj *Object) error
- func (o *Object) SetCacheInvalid(cacheInvalid bool)
- func (o *Object) SetCacheInvalidUnsafe(cacheInvalid bool)
- func (o *Object) SetCompositionUnsafe(field *Field, obj *Object) error
- func (o *Object) SetErrorValue(errors _err.Errors) (err error)
- func (o *Object) SetFieldRV(field *Field, val reflect.Value) (err error)
- func (o *Object) SetFromRV(rv reflect.Value)
- func (o *Object) SetKeyFieldsRV(key *Key, values []reflect.Value) (err error)
- func (o *Object) SetXmlNameValue(xmlName *xml.Name) (err error)
- func (o *Object) SetXmlNameValueFromTag() (err error)
- func (o *Object) SetXmlNameValueFromTagSlice() (err error)
- func (o *Object) SetXmlNameValueSlice(xmlName *xml.Name) (err error)
- func (o *Object) Unlock()
- func (o *Object) ZeroFieldRV(field *Field) (err error)
- type ObjectReferenceMap
- type Objects
- type Options
- type QueryOptions
- type Reference
- func (ref *Reference) AddFieldsToMap(fieldsMap *FieldsMap)
- func (ref *Reference) Entity() *Entity
- func (ref *Reference) Field() *Field
- func (ref *Reference) FieldsMap() FieldsMap
- func (ref *Reference) FieldsString() string
- func (ref *Reference) GetTag(format string, useNameAsDefault bool) string
- func (ref *Reference) GetTagName(format string, useNameAsDefault bool) string
- func (ref *Reference) ToEntity() *Entity
- func (ref *Reference) ToKey() *Key
- func (ref *Reference) ToReference() *Reference
- type ReferenceCardinality
- type ReferenceType
- type References
- type ReferencesMap
- type Tag
- type TypeCache
- type TypeCacheEntry
Constants ¶
const ( FIELD_TYPE_COMPOSITION = "COMPOSITION" FIELD_TYPE_ASSOCIATION = "ASSOCIATION" FIELD_TYPE_XML_NAME = "XMLName" FIELD_TYPE_INTERNAL_ERROR = "*_err.Errors" FIELD_TYPE_CACHE_INVALID = "bool" FIELD_TYPE_VALIDATION_VALID = "bool" FIELD_TYPE_RWMUTEX = "sync.RWMutex" )
const ENTITY_NOT_FOUND = "ENTITY_NOT_FOUND"
const FIELD_NOT_FOUND = "FIELD_NOT_FOUND"
const STATUS_DEPRECATED = "DEPRECATED"
const STATUS_DISABLE = "DISABLE"
const STATUS_ENABLED = "ENABLED"
const TYPE_CACHE_KEY_PREFIX_ALL = "ALL"
const TYPE_CACHE_KEY_PREFIX_EMPTY_REF = "EMPTY_REF"
const TYPE_CACHE_KEY_PREFIX_EMPTY_TAG = "EMPTY_TAG"
Variables ¶
var ( FIELD_TYPE_ASSOCIATION_RT = reflect.TypeOf((*interface{})(nil)).Elem() FIELD_TYPE_COMPOSITION_RT = reflect.TypeOf((*interface{})(nil)).Elem() FIELD_TYPE_XML_NAME_RT = reflect.TypeOf(xml.Name{}) //FIELD_TYPE_INTERNAL_ERROR_RT = reflect.TypeOf((*_err.Errors)(nil)) FIELD_TYPE_INTERNAL_ERROR_RT = reflect.TypeOf((*_err.Errors)(nil)).Elem() FIELD_TYPE_RWMUTEX_RT = reflect.TypeOf(sync.RWMutex{}) )
Functions ¶
func ArgToString ¶
func ArgToString(arg interface{}) string
func ArgsMapToStrings ¶
func ArgsSliceToString ¶
func ArgsSliceToStrings ¶
func ArgsSliceToStrings(args []interface{}) []string
func ArgsToString ¶
func ArgsToStrings ¶
func ArgsToStrings(args ...interface{}) []string
func JSONCamelCase ¶
JSONCamelCase converts a snake_case identifier to a camelCase identifier, according to the protobuf JSON specification.
func JSONSnakeCase ¶
JSONSnakeCase converts a camelCase identifier to a snake_case identifier, according to the protobuf JSON specification.
Types ¶
type Alias ¶
type Alias struct { DisplayName string `yaml:"display_name,omitempty" json:"display_name,omitempty" xml:"display_name,omitempty"` // Имя для отображения FullName string `yaml:"full_name,omitempty" json:"full_name,omitempty" xml:"full_name,omitempty"` // Полное имя для вывода в логи и ошибки Description string `yaml:"description,omitempty" json:"description,omitempty" xml:"description,omitempty"` // Дополнительное описание ExternalName string `yaml:"external_name,omitempty" json:"external_name,omitempty" xml:"external_name,omitempty"` // Имя во внешней системе }
Alias - дополнительные имена и описание
type DbStorage ¶
type DbStorage struct { StorageName string `yaml:"storage_name,omitempty" json:"storage_name,omitempty" xml:"storage_name,omitempty"` // Имя хранилища для сущности SchemaName string `yaml:"schema_name,omitempty" json:"schema_name,omitempty" xml:"schema_name,omitempty"` // Имя схемы таблицы для хранения сущности TableName string `yaml:"table_name,omitempty" json:"table_name,omitempty" xml:"table_name,omitempty"` // Имя таблицы для хранения сущности ObjectName string `yaml:"object_name,omitempty" json:"object_name,omitempty" xml:"object_name,omitempty"` // Имя объекта БД ColumnName string `yaml:"column_name,omitempty" json:"column_name,omitempty" xml:"column_name,omitempty"` // Имя поля в таблице для хранения ColumnType string `yaml:"column_type,omitempty" json:"column_type,omitempty" xml:"column_type,omitempty"` // Тип поля в таблице для хранения ColumnDefault string `yaml:"column_default,omitempty" json:"column_default,omitempty" xml:"column_default,omitempty"` // Значение по умолчанию поля в таблице для хранения ColumnMandatory bool `yaml:"column_mandatory,omitempty" json:"column_mandatory,omitempty" xml:"column_mandatory,omitempty"` // Обязательность поля в таблице для хранения DirectSqlSelect string `yaml:"direct_sql_select,omitempty" json:"direct_sql_select,omitempty" xml:"direct_sql_select,omitempty"` // Прямой SQL для доступа к данным таблицы DirectSqlWhere string `yaml:"direct_sql_where,omitempty" json:"direct_sql_where,omitempty" xml:"direct_sql_where,omitempty"` // Дополнительное правило Where, добавляемое через AND }
DbStorage - параметры для хранения в БД
type Definition ¶
type Definition struct { Name string `yaml:"name,omitempty" json:"name,omitempty" xml:"name,omitempty"` // Имя сущности Source string `yaml:"source,omitempty" json:"source,omitempty" xml:"source,omitempty"` // Источник определения сущности REST, File, DB Format string `yaml:"format,omitempty" json:"format,omitempty" xml:"format,omitempty"` // Тип определения JSON, YAML, XML Json *json.RawMessage `yaml:"text,omitempty" json:"text,omitempty" xml:"text,omitempty"` // Текст определения в читаемом формате SourceFileName string `yaml:"source_file,omitempty" json:"source_file,omitempty" xml:"source_file,omitempty"` // Внешний файл с определением Buf []byte `yaml:"-" json:"-" xml:"-"` // Текст определения }
Definition - определение сущности
func (*Definition) LoadFromFile ¶
func (definition *Definition) LoadFromFile(sourceDir string) error
LoadFromFile - load from file
type Entity ¶
type Entity struct { Type interface{} `yaml:"-" json:"-" xml:"-"` // Тип сущности в виде пустого интерфейса - для настройки валидатора Status string `yaml:"status,omitempty" json:"status,omitempty" xml:"status,omitempty"` // Статус ENABLED, DEPRECATED, ... StorageName string `yaml:"storage_name,omitempty" json:"storage_name,omitempty" xml:"storage_name,omitempty"` // Имя хранилища для сущности Name string `yaml:"name,omitempty" json:"name,omitempty" xml:"name,omitempty"` // Имя сущности InheritFromName string `yaml:"inherit_from,omitempty" json:"inherit_from,omitempty" xml:"inherit_from,omitempty"` // Наследовать характеристики с другой сущности с возможностью переопределения SkipCache bool `yaml:"skip_cache,omitempty" json:"skip_cache,omitempty" xml:"skip_cache,omitempty"` // Принудительно отключить Cache, по умолчанию включено Embed bool `yaml:"embed" json:"embed" xml:"embed"` // Признак, что объект всегда встраивается Alias Alias `yaml:"alias,omitempty" json:"alias,omitempty" xml:"alias,omitempty"` // Дополнительные имена, коды и описание DbStorage DbStorage `yaml:"db_storage,omitempty" json:"db_storage,omitempty" xml:"db_storage,omitempty"` // Параметры хранения в БД Tag Tag `yaml:"tag,omitempty" json:"tag,omitempty" xml:"tag,omitempty"` // Имена различных тегов для парсинга данных Modify Modify `yaml:"modify,omitempty" json:"modify,omitempty" xml:"modify,omitempty"` // Разрешенные операции с сущностью Exprs Exprs `yaml:"expressions,omitempty" json:"expressions,omitempty" xml:"expressions,omitempty"` // Выражение для вычисления или проверки KeysDef Keys `yaml:"keys,omitempty" json:"keys,omitempty" xml:"keys,omitempty"` // Ключи сущности из определения ReferencesDef References `yaml:"references,omitempty" json:"references,omitempty" xml:"references,omitempty"` // Ссылки на родительские и дочерние сущности Fields Fields `yaml:"fields,omitempty" json:"fields,omitempty" xml:"fields,omitempty"` // Поля сущности, включая ссылки FK и отношения M:1 Definition *Definition `yaml:"definition,omitempty" json:"definition,omitempty" xml:"definition,omitempty"` // Определение сущности // contains filtered or unexported fields }
func (*Entity) AddPkFieldsToMap ¶
func (*Entity) AddSystemFieldsToMap ¶
func (*Entity) AssociationMap ¶
func (*Entity) CacheInvalidValuePtr ¶
func (*Entity) CompositionMap ¶
func (*Entity) CopyMapToStruct ¶
func (entity *Entity) CopyMapToStruct(fromMapInterface interface{}, toRow *Object, outFields FieldsMap) (empty bool, err error)
CopyMapToStruct - Копирование map в struct
func (*Entity) CopyObjectSlice ¶
func (entity *Entity) CopyObjectSlice(fromSlice *Object, toSlice *Object, outFields FieldsMap) (err error)
CopyObjectSlice Копирование slice через его указатель по совпадающим полям в структуре
func (*Entity) CopyObjectStruct ¶
func (entity *Entity) CopyObjectStruct(fromStruct *Object, toStruct *Object, outFields FieldsMap) (err error)
CopyObjectStruct Копирование struct через его указатель по совпадающим полям в структуре
func (*Entity) CopySlicePtrByFieldName ¶
func (entity *Entity) CopySlicePtrByFieldName(fromPtr interface{}, toPtr interface{}, outFields FieldsMap) (err error)
CopySlicePtrByFieldName Копирование slice через его указатель по совпадающим полям в структуре
func (*Entity) CopyStructPtrByFieldName ¶
func (entity *Entity) CopyStructPtrByFieldName(fromPtr interface{}, toPtr interface{}, outFields FieldsMap) (err error)
CopyStructPtrByFieldName Копирование struct через его указатель по совпадающим полям в структуре
func (*Entity) DefTypeCacheKey ¶
func (*Entity) DefTypeCacheKeyEmptyRef ¶
func (*Entity) DefTypeCacheKeyEmptyTag ¶
func (*Entity) ExprsByAction ¶
func (entity *Entity) ExprsByAction(action ExprAction) *Exprs
func (*Entity) FieldByName ¶
func (*Entity) FieldByTagName ¶
func (*Entity) FieldDisplayName ¶
func (*Entity) FieldFullName ¶
func (*Entity) FieldValue ¶
FieldValue - получить в указанной структуре значение поля
func (*Entity) FieldValuePtr ¶
func (entity *Entity) FieldValuePtr(field *Field, structPtrValue reflect.Value) (value reflect.Value, err error)
FieldValuePtr - получить в указанной структуре поле по его индексу
func (*Entity) FieldsExprs ¶
func (*Entity) FieldsExprsByAction ¶
func (entity *Entity) FieldsExprsByAction(action ExprAction) *Exprs
func (*Entity) FieldsValue ¶
FieldsValue - получить в указанной структуре поля по списку
func (*Entity) FieldsValuePtr ¶
func (entity *Entity) FieldsValuePtr(fields Fields, structPtrValue reflect.Value) (values []interface{}, err error)
FieldsValuePtr - получить в указанной структуре поля по списку
func (*Entity) GetAssociation ¶
func (*Entity) GetComposition ¶
func (*Entity) GetTagName ¶
func (*Entity) GetXMLName ¶
func (*Entity) GetXmlNameFromTag ¶
func (*Entity) HasAssociations ¶
func (*Entity) HasCompositions ¶
func (*Entity) KeyFieldsRV ¶
KeyFieldsRV - получить в указанной структуре поля ключа
func (*Entity) KeyFieldsValue ¶
KeyFieldsValue - получить в указанной структуре поля ключа
func (*Entity) KeyFieldsValuePtr ¶
func (entity *Entity) KeyFieldsValuePtr(key *Key, structPtrValue reflect.Value) (values []interface{}, err error)
KeyFieldsValuePtr - получить в указанной структуре поля ключа
func (*Entity) PKFieldsName ¶
PKFieldsName - ограниченный набор полей - только PK
func (*Entity) ReferenceByName ¶
func (*Entity) ReferenceFieldsValue ¶
func (entity *Entity) ReferenceFieldsValue(reference *Reference, row *Object) (values []interface{}, err error)
ReferenceFieldsValue - получить в указанной структуре поля reference
func (*Entity) ReferenceFieldsValuePtr ¶
func (entity *Entity) ReferenceFieldsValuePtr(reference *Reference, structPtrValue reflect.Value) (values []interface{}, err error)
ReferenceFieldsValuePtr - получить в указанной структуре поля reference
func (*Entity) References ¶
func (entity *Entity) References() References
func (*Entity) SetCacheInvalidValuePtr ¶
func (*Entity) SetErrorValue ¶
func (*Entity) SetErrorValuePtr ¶
func (*Entity) SetFieldRV ¶
SetFieldRV - установить в указанной структуре поле по его индексу
func (*Entity) SetFieldValuePtr ¶
func (entity *Entity) SetFieldValuePtr(field *Field, structPtrValue reflect.Value, val reflect.Value) (err error)
SetFieldValuePtr - установить в указанной структуре поле по его индексу
func (*Entity) SetTypeCache ¶
func (entity *Entity) SetTypeCache(key string, inRowType reflect.Type) (typeCacheEntry *TypeCacheEntry)
func (*Entity) SetXmlNameValue ¶
func (*Entity) SetXmlNameValueFromTag ¶
func (*Entity) SetXmlNameValueFromTagSlice ¶
func (*Entity) SetXmlNameValuePtr ¶
func (*Entity) SetXmlNameValuePtrFromTag ¶
func (*Entity) SetXmlNameValuePtrFromTagSlice ¶
func (*Entity) SetXmlNameValueSlice ¶
func (*Entity) StructFields ¶
func (*Entity) StructFieldsMap ¶
func (*Entity) TypeCacheKey ¶
func (*Entity) ValidationRules ¶
func (*Entity) ValidationRulesType ¶
type EntityMap ¶
func (EntityMap) GetDisplayName ¶
func (EntityMap) GetEntitySafe ¶
func (EntityMap) GetFieldDisplayName ¶
func (EntityMap) GetFieldFullName ¶
func (EntityMap) GetFullName ¶
type Expr ¶
type Expr struct { Status string `yaml:"status" json:"status" xml:"status"` // Статус поля ENABLED, DEPRECATED, ... Name string `yaml:"name,omitempty" json:"name,omitempty" xml:"name,omitempty"` // Имя выражения Type ExprType `yaml:"type,omitempty" json:"type,omitempty" xml:"type,omitempty"` // Тип выражения Action ExprAction `yaml:"action,omitempty" json:"action,omitempty" xml:"action,omitempty"` // В каких условиях срабатывает выражение Code string `yaml:"code,omitempty" json:"code,omitempty" xml:"code,omitempty"` // Текст выражения FieldsArgsName []string `yaml:"fields,omitempty" json:"fields,omitempty" xml:"fields,omitempty"` // Поля сущности, участвующие в выражении FieldsDestName []string `yaml:"fields_dest,omitempty" json:"fields_dest,omitempty" xml:"fields_dest,omitempty"` // Поля сущности, которым присвоить результат // contains filtered or unexported fields }
Expr - вычисляемое выражение
func (*Expr) ArgsFields ¶
func (*Expr) CalculateField ¶
func (*Expr) CheckAction ¶
func (ex *Expr) CheckAction(action ExprAction) bool
func (*Expr) DestFields ¶
func (*Expr) FilterSlice ¶
func (*Expr) FilterSliceFromStructField ¶
type ExprAction ¶
type ExprAction string
const ( EXPR_ACTION_NULL ExprAction = "NULL" // Фиктивная константа - ни чего не делать EXPR_ACTION_ALL ExprAction = "ALL" // Выполнять все вычисления EXPR_ACTION_GET ExprAction = "GET" // Срабатывает POST_GET и INSIDE_GET EXPR_ACTION_POST_FETCH ExprAction = "POST_FETCH" // Срабатывает сразу после извлечения одной строки из источника хранения EXPR_ACTION_INSIDE_GET ExprAction = "INSIDE_GET" // Срабатывает в самом конце извлечение полного дерева сущностей EXPR_ACTION_POST_GET ExprAction = "POST_GET" // Срабатывает после извлечения данных из кэша или внешнего источника по данной сущности EXPR_ACTION_PUT ExprAction = "PUT" EXPR_ACTION_PRE_PUT ExprAction = "PRE_PUT" // Срабатывает перед началом вставки на данных исходной записи EXPR_ACTION_INSIDE_PUT ExprAction = "INSIDE_PUT" // Срабатывает перед началом вставки на данных исходной записи EXPR_ACTION_POST_PUT ExprAction = "POST_PUT" // Срабатывает после вставки на данных вставленной записи EXPR_ACTION_MARSHAL ExprAction = "MARSHAL" // Срабатывает после разбора одного объекта EXPR_ACTION_PRE_MARSHAL ExprAction = "PRE_MARSHAL" // Срабатывает после начала разбора одного объекта EXPR_ACTION_POST_MARSHAL ExprAction = "POST_MARSHAL" // Срабатывает после разбора всех объектов )
type ExprsByAction ¶
type ExprsByAction map[ExprAction]*Exprs
type Field ¶
type Field struct { Status string `yaml:"status,omitempty" json:"status,omitempty" xml:"status,omitempty"` // Статус поля ENABLED, DEPRECATED, ... Order int `yaml:"order,omitempty" json:"order,omitempty" xml:"order,omitempty"` // Порядковый номер поля в сущности Required bool `yaml:"required,omitempty" json:"required,omitempty" xml:"required,omitempty"` // Признак, что поле обязательное в сущности, это не означает что оно должно быть заполнено Name string `yaml:"name,omitempty" json:"name,omitempty" xml:"name,omitempty"` // Имя поля InheritFromName string `yaml:"inherit_from,omitempty" json:"inherit_from,omitempty" xml:"inherit_from,omitempty"` // Наследовать характеристики CopyFromName string `yaml:"copy_from,omitempty" json:"copy_from,omitempty" xml:"copy_from,omitempty"` // Скопировать характеристики поля с другой сущности InternalType string `yaml:"internal_type,omitempty" json:"internal_type,omitempty" xml:"internal_type,omitempty"` // Тип поля - внутренний Format string `yaml:"format,omitempty" json:"format,omitempty" xml:"format,omitempty"` // Формат поля ValidateRule string `yaml:"validate_rule,omitempty" json:"validate_rule,omitempty" xml:"validate_rule,omitempty"` // Правила валидации поля System bool `yaml:"system,omitempty" json:"system,omitempty" xml:"system,omitempty"` // Признак, системного поля Alias Alias `yaml:"alias,omitempty" json:"alias,omitempty" xml:"alias,omitempty"` // Дополнительные имена, коды и описание DbStorage DbStorage `yaml:"db_storage,omitempty" json:"db_storage,omitempty" xml:"db_storage,omitempty"` // Параметры хранения в БД Tag Tag `yaml:"tag,omitempty" json:"tag,omitempty" xml:"tag,omitempty"` // Имена различных тегов для парсинга данных Modify Modify `yaml:"modify,omitempty" json:"modify,omitempty" xml:"modify,omitempty"` // Разрешенные операции с полем Exprs Exprs `yaml:"expressions,omitempty" json:"expressions,omitempty" xml:"expressions,omitempty"` // Выражение для вычисления или проверки // contains filtered or unexported fields }
func (*Field) CheckFieldReference ¶
func (*Field) GetTagName ¶
func (*Field) GetXmlNameFromTag ¶
func (*Field) References ¶
func (field *Field) References() References
func (*Field) ReflectType ¶
type FieldNumber ¶
type FieldNumber int32
type Fields ¶
type Fields []*Field
func (Fields) GetDisplayName ¶
func (Fields) GetFullName ¶
func (Fields) GetValidationRules ¶
type FieldsMap ¶
func (FieldsMap) GetDisplayName ¶
func (FieldsMap) GetFullName ¶
func (FieldsMap) GetValidationRules ¶
type FieldsV2 ¶
type GlobalOptions ¶
type GlobalOptions struct { NameFormat string // [name_format] формат именования полей в параметрах запроса 'json', 'yaml', 'xml', 'xsl', 'name' OutFormat string // [out_format] формат вывода результата 'json', 'yaml', 'xml', 'xsl' TxExternal uint64 // [tx] идентификатор внешней транзакции SkipCache bool // [skip_cache] принудительно считать из внешнего источника SkipCalculation bool // [skip_calculation] принудительно отключить все вычисления UseCache bool // [use_cache] принудительно использовать кеширование - имеет приоритет над skip_cache EmbedError bool // [embed_error] встраивать отдельные типы некритичных ошибок в текст ответа IgnoreExtraField bool // [ignore_extra_field] игнорировать лишние поля в параметрах запроса Validate bool // [validate] проверка данных OutTrace bool // [out_trace] вывод трассировки MultiRow bool // [multi_row] признак многострочной обработки StaticFiltering bool // [filter] признак статической фильтрации Persist bool // [persist] признак, что отправлять данные в хранилище KeepLock bool // признак блокировать данные в cache }
GlobalOptions глобальные опции расчета
type Key ¶
type Key struct { Status string `yaml:"status" json:"status" xml:"status"` // Статус поля ENABLED, DEPRECATED, ... Name string `yaml:"name" json:"name" xml:"name"` // Имя ключа InheritFromName string `yaml:"inherit_from,omitempty" json:"inherit_from,omitempty" xml:"inherit_from,omitempty"` // Наследовать характеристики CopyFromName string `yaml:"copy_from,omitempty" json:"copy_from,omitempty" xml:"copy_from,omitempty"` // Скопировать характеристики с другой сущности Type KeyType `yaml:"type" json:"type" xml:"type"` // Тип ключа FieldsName []string `yaml:"fields" json:"fields" xml:"fields"` // Поля ключа Alias Alias `yaml:"alias,omitempty" json:"alias,omitempty" xml:"alias,omitempty"` // Дополнительные имена, коды и описание DbStorage DbStorage `yaml:"db_storage,omitempty" json:"db_storage,omitempty" xml:"db_storage,omitempty"` // Параметры хранения в БД Modify Modify `yaml:"modify,omitempty" json:"modify,omitempty" xml:"modify,omitempty"` // Разрешенные операции с полями ключа // contains filtered or unexported fields }
Key - ключ сущности
func (*Key) AddFieldsToMap ¶
func (*Key) FieldsString ¶
type Meta ¶
type Meta struct { Status string `yaml:"status,omitempty" json:"status,omitempty" xml:"status,omitempty"` // Статус ENABLED, DEPRECATED, ... Name string `yaml:"name,omitempty" json:"name,omitempty" xml:"name,omitempty"` // Имя меты Entities Entities `yaml:"entities,omitempty" json:"entities,omitempty" xml:"entities,omitempty"` // Сущности в "правильном" порядке для создания // contains filtered or unexported fields }
func (*Meta) GetDisplayName ¶
func (*Meta) GetEntitySafe ¶
func (*Meta) GetEntityUnsafe ¶
func (*Meta) GetFieldDisplayName ¶
func (*Meta) GetFieldFullName ¶
func (*Meta) GetFullName ¶
func (*Meta) InitUnsafe ¶
func (*Meta) SetEntityFromDefinitionUnsafe ¶
type Modify ¶
type Modify struct { CreateRestrict bool `yaml:"create_restrict,omitempty" json:"create_restrict,omitempty" xml:"create_restrict,omitempty"` // Признак, что запрещено вставлять данные в сущность или поле RetrieveRestrict bool `yaml:"retrieve_restrict,omitempty" json:"retrieve_restrict,omitempty" xml:"retrieve_restrict,omitempty"` // Признак, что запрещено считывать данные в сущность или поле UpdateRestrict bool `yaml:"update_restrict,omitempty" json:"update_restrict,omitempty" xml:"update_restrict,omitempty"` // Признак, что запрещено обновлять данные в сущность или поле DeleteRestrict bool `yaml:"delete_restrict,omitempty" json:"delete_restrict,omitempty" xml:"delete_restrict,omitempty"` // Признак, что запрещено удалять данные в сущность или поле CopyRestrict bool `yaml:"copy_restrict,omitempty" json:"copy_restrict,omitempty" xml:"copy_restrict,omitempty"` // Признак, что запрещено копировать сущность или поле при внутренней обработке VisibleRestrict bool `yaml:"visible_restrict,omitempty" json:"visible_restrict,omitempty" xml:"visible_restrict,omitempty"` // Признак, что запрещено показывать полей }
Modify - параметры управления модификацией объекта
type Object ¶
type Object struct { Entity *Entity // ссылка на сущность Reference *Reference // Заполняется, если объект является ссылочным полем Fields FieldsMap // реальный список полей в объекте - может отличаться в меньшую сторону Value interface{} // указатель на struct или slice с данными RV reflect.Value // reflect.ValueOf(Value) StructType reflect.Type // тип struct{} или []*struct{} с данными StructPtrType reflect.Type // тип *struct{} или []*struct{} с данными Options *Options // Опции, на которых был построен объект TODO при сохранении в кэш опции нужно очищать IsSlice bool // признак, что объект является slice Objects Objects // для slice содержит массив объектов AssociationMap ObjectReferenceMap // ассоциации, повешенные на поля CompositionMap ObjectReferenceMap // композиции, повешенные на поля OrgObject *Object // указатель на struct или slice с данными, на основании которого построен данный объект // contains filtered or unexported fields }
func (*Object) AppendObject ¶
func (*Object) CacheInvalid ¶
func (*Object) ClearObjects ¶
func (o *Object) ClearObjects()
func (*Object) CopyAssociationFrom ¶
func (*Object) CopyCompositionFrom ¶
func (*Object) FieldValue ¶
func (*Object) FieldsValue ¶
func (*Object) KeyFieldsRV ¶
func (*Object) KeyFieldsValue ¶
func (*Object) KeyValueString ¶
func (*Object) KeysValueString ¶
func (*Object) ReferenceFieldsValue ¶
func (*Object) SetAssociationUnsafe ¶
func (*Object) SetCacheInvalid ¶
func (*Object) SetCacheInvalidUnsafe ¶
func (*Object) SetCompositionUnsafe ¶
func (*Object) SetFieldRV ¶
func (*Object) SetKeyFieldsRV ¶
func (*Object) SetXmlNameValueFromTag ¶
func (*Object) SetXmlNameValueFromTagSlice ¶
func (*Object) SetXmlNameValueSlice ¶
func (*Object) ZeroFieldRV ¶
type ObjectReferenceMap ¶
type Options ¶
type Options struct { Key string // Ключ, используются для поиска в cache, формат EntityName.EntityName. Entity *Entity // Обрабатываемая сущность FromEntity *Entity // Сущность из которой конвертировать CascadeUp int // [cascade_up] сколько уровней вверх по FK CascadeDown int // [cascade_down] сколько уровней вниз по FK DbOrder string // [db_order] последовательность сортировки строк в ответе DbWhere string // [db_where] фраза where для встраивания в запрос DbLimit string // [db_limit] ограничение на выборку данных в запросе DbOffset string // [db_offset] сдвиг строки, с которой начать выводить данные в запросе DbFieldsWhere map[string]string // Доп фильтрация по полям Fields FieldsMap // Ограничение на обрабатываемые поля FilterPreExpr *Expr // Правило фильтрации текущего slice в начале обработки (до вычисления всех полей) FilterPostExpr *Expr // Правило фильтрации текущего slice в конце обработки (после вычисления всех полей и выполнения всех внутренних фильтраций) FilterPostRefExprs map[*Reference]*Expr // Правила фильтрации вложенных Composition в конце обработки QueryOptions QueryOptions // опции запроса QueryOptionsDown QueryOptions // опции запроса для проброса ниже Global *GlobalOptions // глобальные опции расчета }
Options опции расчета
type QueryOptions ¶
QueryOptions опции запроса
func (*QueryOptions) Copy ¶
func (opt *QueryOptions) Copy() (out QueryOptions)
type Reference ¶
type Reference struct { Status string `yaml:"status" json:"status" xml:"status"` // Статус поля ENABLED, DEPRECATED, ... Name string `yaml:"name" json:"name" xml:""` // Имя ключа InheritFromName string `yaml:"inherit_from,omitempty" json:"inherit_from,omitempty" xml:"inherit_from,omitempty"` // Наследовать характеристики CopyFromName string `yaml:"copy_from,omitempty" json:"copy_from,omitempty" xml:"copy_from,omitempty"` // Скопировать характеристики с другой сущности Required bool `yaml:"required" json:"required" xml:"required"` // Признак, что ссылка обязательная в сущности ToEntityName string `yaml:"to_entity" json:"to_entity" xml:"to_entity"` // Имя сущности, на которую ссылаемся ToKeyName string `yaml:"to_key" json:"to_key" xml:"to_key"` // Имя ключа, на который ссылаемся ToReferenceName string `yaml:"to_reference" json:"to_reference" xml:"to_reference"` // Имя reference - зеркального данному Composition-Association Type ReferenceType `yaml:"type" json:"type" xml:"type"` // Тип ссылки Cardinality ReferenceCardinality `yaml:"cardinality" json:"cardinality" xml:"cardinality"` // cardinality ссылки Embed bool `yaml:"embed" json:"embed" xml:"embed"` // Признак, что подчиненный объект встраивается по ссылке FieldsName []string `yaml:"fields" json:"fields" xml:"fields"` // Поля сущности, которая ссылается, должны совпадать по списку и типу ValidateRule string `yaml:"validate_rule" json:"validate_rule" xml:"validate_rule"` // Правила валидации поля Alias Alias `yaml:"alias,omitempty" json:"alias,omitempty" xml:"alias,omitempty"` // Дополнительные имена, коды и описание DbStorage DbStorage `yaml:"db_storage,omitempty" json:"db_storage,omitempty" xml:"db_storage,omitempty"` // Параметры хранения в БД Tag Tag `yaml:"tag,omitempty" json:"tag,omitempty" xml:"tag,omitempty"` // Имена различных тегов для парсинга данных Exprs Exprs `yaml:"expressions,omitempty" json:"expressions,omitempty" xml:"expressions,omitempty"` // Выражение для вычисления или проверки // contains filtered or unexported fields }
Reference - ссылка между сущностями
func (*Reference) AddFieldsToMap ¶
func (*Reference) FieldsString ¶
func (*Reference) GetTagName ¶
func (*Reference) ToReference ¶
type ReferenceCardinality ¶
type ReferenceCardinality string
const ( REFERENCE_CARDINALITY_EMPTY ReferenceCardinality = "" // Отношение 0 REFERENCE_CARDINALITY_0 ReferenceCardinality = "0" // Отношение 0 REFERENCE_CARDINALITY_1 ReferenceCardinality = "1" // Отношение 1 REFERENCE_CARDINALITY_M ReferenceCardinality = "M" // Отношение M )
type ReferenceType ¶
type ReferenceType string
const ( REFERENCE_TYPE_ASSOCIATION ReferenceType = "Association" // Отношение от подчиненной записи на родителя REFERENCE_TYPE_COMPOSITION ReferenceType = "Composition" // Отношение от родителя на подчиненные записи )
type ReferencesMap ¶
ReferencesMap - ссылки между сущностями
func (ReferencesMap) Get ¶
func (referencesMap ReferencesMap) Get(name string) *Reference
type Tag ¶
type Tag struct { Db string `yaml:"db,omitempty" json:"db,omitempty" xml:"db,omitempty"` // Имя поля в таблице для хранения Json string `yaml:"json,omitempty" json:"json,omitempty" xml:"json,omitempty"` // Tag для вывода в Json Xml string `yaml:"xml,omitempty" json:"xml,omitempty" xml:"xml,omitempty"` // Tag для вывода в XML XmlSpace string `yaml:"xml_space,omitempty" json:"xml_space,omitempty" xml:"xml_space,omitempty"` // Tag для вывода в XML Yaml string `yaml:"yaml,omitempty" json:"yaml,omitempty" xml:"yaml,omitempty"` // Tag для вывода в YAML Xls string `yaml:"xls,omitempty" json:"xls,omitempty" xml:"xls,omitempty"` // Tag для вывода в XLS - заголовок поля XlsSheet string `yaml:"xls_sheet,omitempty" json:"xls_sheet,omitempty" xml:"xls_sheet,omitempty"` // Tag для вывода в XLS - имя закладки Expr string `yaml:"expr,omitempty" json:"expr,omitempty" xml:"expr,omitempty"` // Tag для выполнения выражений Sql string `yaml:"sql,omitempty" json:"sql,omitempty" xml:"sql,omitempty"` // Tag для обработки sql DbName string `yaml:"-" json:"-" xml:"-"` // Имя поля в таблице для хранения JsonName string `yaml:"-" json:"-" xml:"-"` // Имя для вывода в Json XmlName string `yaml:"-" json:"-" xml:"-"` // Имя для вывода в XML YamlName string `yaml:"-" json:"-" xml:"-"` // Имя для вывода в YAML XlsName string `yaml:"-" json:"-" xml:"-"` // Имя для вывода в XLS ExprName string `yaml:"-" json:"-" xml:"-"` // Имя для выполнения выражений }
Tag - Имена различных тегов для парсинга данных
type TypeCache ¶
type TypeCache struct {
// contains filtered or unexported fields
}
func NewTypeCache ¶
func NewTypeCache() *TypeCache
type TypeCacheEntry ¶
type TypeCacheEntry struct {
// contains filtered or unexported fields
}
Source Files
¶
- meta.go
- meta_alias.go
- meta_dbstorage.go
- meta_definition.go
- meta_entities.go
- meta_entity.go
- meta_entity_copy_map.go
- meta_entity_copy_object.go
- meta_entity_copy_ptr.go
- meta_entity_inherit.go
- meta_entity_init.go
- meta_entity_reflect.go
- meta_entity_reflect_ptr.go
- meta_expr.go
- meta_expr_calc.go
- meta_expr_copy.go
- meta_expr_filter.go
- meta_expr_init.go
- meta_field.go
- meta_field_reflect.go
- meta_fields_v2.go
- meta_init.go
- meta_key.go
- meta_modify.go
- meta_object.go
- meta_options.go
- meta_proto.go
- meta_reference.go
- meta_tag.go
- meta_typecache.go
- meta_utl.go