Documentation ¶
Index ¶
- Variables
- type Action
- type Config
- type EntityConfig
- type OptionsCache
- type QueryOptionConfig
- type Service
- func (s *Service) ConvertMarshal(ctx context.Context, entityName string, inBuf []byte, inFormat string, ...) (outBuf []byte, outFormat string, err error)
- func (s *Service) CreateEntityMeta(ctx context.Context, inBuf []byte, format string) (result bool, outBuf []byte, err error)
- func (s *Service) CreateMarshal(ctx context.Context, entityName string, inBuf []byte, inFormat string, ...) (outBuf []byte, outFormat string, err error, errors _err.Errors)
- func (s *Service) Get(ctx context.Context, requestID uint64, entity *_meta.Entity, ...) (exists bool, rowOut *_meta.Object, err error, errors _err.Errors)
- func (s *Service) GetEntity(entityName string) *_meta.Entity
- func (s *Service) GetEntityMeta(ctx context.Context, entityName, format string) (exists bool, outBuf []byte, myerr error)
- func (s *Service) GetMarshal(ctx context.Context, entityName string, inFormat string, ...) (exists bool, outBuf []byte, outFormat string, err error, errors _err.Errors)
- func (s *Service) GetOptionFromCache(ctx context.Context, key string) *_meta.Options
- func (s *Service) InitValidator() (err error)
- func (s *Service) MarshalXls(requestID uint64, val any, name string, inFile multipart.File) (buf []byte, myerr error)
- func (s *Service) PopulateAllEntityCache(ctx context.Context) (err error)
- func (s *Service) PopulateEntityCache(ctx context.Context, entity *_meta.Entity) (err error)
- func (s *Service) RegisterStorage(name string, storage _storage.Service) (err error)
- func (s *Service) RegisterStorages(storageMap map[string]_storage.Service) (err error)
- func (s *Service) Select(ctx context.Context, requestID uint64, entity *_meta.Entity, ...) (exists bool, rowsOut *_meta.Object, err error, errors _err.Errors)
- func (s *Service) SelectMarshal(ctx context.Context, entityName string, inFormat string, ...) (exists bool, outBuf []byte, outFormat string, err error, errors _err.Errors)
- func (s *Service) SetOptionToCache(ctx context.Context, key string, options *_meta.Options)
- func (s *Service) Shutdown() (err error)
- func (s *Service) UpdateEntityMeta(ctx context.Context, inBuf []byte, entityName, format string) (result bool, outBuf []byte, err error)
- func (s *Service) XlsMarshal(ctx context.Context, entityName string, queryOptions _meta.QueryOptions, ...) (outBuf []byte, err error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ConvertRowTestCase1Data = `` /* 509534-byte string literal not displayed */
View Source
var ConvertRowTestCase2Data = `` /* 348025-byte string literal not displayed */
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action string
const ( PERSIST_ACTION_NONE Action = "None" // Фиктивная пустая action PERSIST_ACTION_GET Action = "Get" // Запрос одного объекта PERSIST_ACTION_CREATE Action = "Create" // Создание объекта PERSIST_ACTION_UPDATE Action = "Update" // Обновление объекта PERSIST_ACTION_DELETE Action = "Delete" // Удаление объекта PERSIST_ACTION_MERGE Action = "Merge" // Слияние объекта )
type Config ¶
type Config struct { EntityConfigFile string `yaml:"entity_config_file" json:"entity_config_file"` PopulateCacheOnStart bool `yaml:"populate_cache_on_start" json:"populate_cache_on_start"` QueryOption QueryOptionConfig `yaml:"query_option" json:"query_option"` EntityConfig EntityConfig `yaml:"entity_config" json:"entity_config"` Meta *_meta.Meta `yaml:"meta" json:"meta"` }
Config конфигурационные настройки
type EntityConfig ¶
type EntityConfig struct { EntityDirName string `yaml:"source_dir" json:"source_dir"` Definition []_meta.Definition `yaml:"definition,omitempty" json:"definition,omitempty" xml:"definition,omitempty"` // Определение сущностей }
EntityConfig конфигурационные настройки сущностей
type OptionsCache ¶
type QueryOptionConfig ¶
type QueryOptionConfig struct { DelimiterStart string `yaml:"delimiter_start" json:"delimiter_start"` // [ разделить начало для определения спец параметров DelimiterEnd string `yaml:"delimiter_end" json:"delimiter_end"` // ] разделить конец для определения спец параметров FromEntity string `yaml:"from_entity" json:"from_entity"` // [from_entity] имя входной сущности Fields string `yaml:"fields" json:"fields"` // [fields] фильтрация список полей в ответе SkipCache string `yaml:"skip_cache" json:"skip_cache"` // [skip_cache] принудительно считать из внешнего источника SkipCalculation string `yaml:"skip_calculation" json:"skip_calculation"` // [skip_calculation] принудительно отключить все вычисления UseCache string `yaml:"use_cache" json:"use_cache"` // [use_cache] принудительно использовать кеширование - имеет приоритет над skip_cache EmbedError string `yaml:"embed_error" json:"embed_error"` // [embed_error] встраивать отдельные типы некритичных ошибок в текст ответа CascadeUp string `yaml:"cascade_up" json:"cascade_up"` // [cascade_up] сколько уровней вверх по FK CascadeDown string `yaml:"cascade_down" json:"cascade_down"` // [cascade_down] сколько уровней вниз по FK TxExternal string `yaml:"tx" json:"tx"` // [tx] идентификатор внешней транзакции IgnoreExtraField string `yaml:"ignore_extra_field" json:"ignore_extra_field"` // [ignore_extra_field] игнорировать лишние поля в параметрах запроса NameFormat string `yaml:"name_format" json:"name_format"` // [name_format] формат именования полей в параметрах запроса 'json', 'yaml', 'xml', 'xsl', 'name' OutFormat string `yaml:"out_format" json:"out_format"` // [out_format] формат вывода результата 'json', 'yaml', 'xml', 'xsl' OutTrace string `yaml:"out_trace" json:"out_trace"` // [out_trace] вывод трассировки Validate string `yaml:"validate" json:"validate"` // [validate] проверка данных MultiRow string `yaml:"multi_row" json:"multi_row"` // [multi_row] признак многострочной обработки Filter string `yaml:"filter" json:"filter"` // [filter] признак фильтрации StaticFiltering string `yaml:"static_filtering" json:"static_filtering"` // [static_filtering] признак статической фильтрации Persist string `yaml:"persist" json:"persist"` // [persist] признак, что отправлять данные в хранилище DbOrder string `yaml:"db_order" json:"db_order"` // [db_order] последовательность сортировки строк в ответе DbWhere string `yaml:"db_where" json:"db_where"` // [db_where] фраза where для встраивания в запрос DbLimit string `yaml:"db_limit" json:"db_limit"` // [db_limit] ограничение на выборку данных в запросе DbOffset string `yaml:"db_offset" json:"db_offset"` // [db_offset] сдвиг строки, с которой начать выводить данные в запросе DelimiterStartFilter string `yaml:"-" json:"-"` DelimiterStartFull string `yaml:"-" json:"-"` DelimiterEndFull string `yaml:"-" json:"-"` FromEntityFull string `yaml:"-" json:"-"` FieldsFull string `yaml:"-" json:"-"` SkipCacheFull string `yaml:"-" json:"-"` SkipCalculationFull string `yaml:"-" json:"-"` UseCacheFull string `yaml:"-" json:"-"` EmbedErrorFull string `yaml:"-" json:"-"` CascadeUpFull string `yaml:"-" json:"-"` CascadeDownFull string `yaml:"-" json:"-"` TxExternalFull string `yaml:"-" json:"-"` IgnoreExtraFieldFull string `yaml:"-" json:"-"` NameFormatFull string `yaml:"-" json:"-"` OutFormatFull string `yaml:"-" json:"-"` OutTraceFull string `yaml:"-" json:"-"` ValidateFull string `yaml:"-" json:"-"` MultiRowFull string `yaml:"-" json:"-"` FilterFull string `yaml:"-" json:"-"` StaticFilteringFull string `yaml:"-" json:"-"` PersistFull string `yaml:"-" json:"-"` DbOrderFull string `yaml:"-" json:"-"` DbWhereFull string `yaml:"-" json:"-"` DbLimitFull string `yaml:"-" json:"-"` DbOffsetFull string `yaml:"-" json:"-"` }
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service represent API service
func New ¶
func New(ctx context.Context, errCh chan<- error, cfg *Config, storageMap map[string]_storage.Service, cache cache.CacheService, gMeta *_meta.Meta) (*Service, error)
New returns a new Service
func (*Service) ConvertMarshal ¶
func (s *Service) ConvertMarshal(ctx context.Context, entityName string, inBuf []byte, inFormat string, queryOptions _meta.QueryOptions) (outBuf []byte, outFormat string, err error)
ConvertMarshal преобразовать между сущностями
func (*Service) CreateEntityMeta ¶
func (s *Service) CreateEntityMeta(ctx context.Context, inBuf []byte, format string) (result bool, outBuf []byte, err error)
CreateEntityMeta создать метаданные entity
func (*Service) CreateMarshal ¶
func (s *Service) CreateMarshal(ctx context.Context, entityName string, inBuf []byte, inFormat string, queryOptions _meta.QueryOptions) (outBuf []byte, outFormat string, err error, errors _err.Errors)
CreateMarshal создать строку во внешнем сервисе
func (*Service) Get ¶
func (s *Service) Get(ctx context.Context, requestID uint64, entity *_meta.Entity, options *_meta.Options, cascadeUp int, cascadeDown int, key *_meta.Key, keyArgs ...interface{}) (exists bool, rowOut *_meta.Object, err error, errors _err.Errors)
Get извлечь данные в struct - только запрошенные поля
func (*Service) GetEntityMeta ¶
func (s *Service) GetEntityMeta(ctx context.Context, entityName, format string) (exists bool, outBuf []byte, myerr error)
GetEntityMeta извлечь метаданные entity
func (*Service) GetMarshal ¶
func (s *Service) GetMarshal(ctx context.Context, entityName string, inFormat string, queryOptions _meta.QueryOptions, keyArgs ...interface{}) (exists bool, outBuf []byte, outFormat string, err error, errors _err.Errors)
GetMarshal извлечь данные и преобразовать в JSON / XML / YAML / XLS
func (*Service) GetOptionFromCache ¶
func (*Service) InitValidator ¶
func (*Service) MarshalXls ¶
func (s *Service) MarshalXls(requestID uint64, val any, name string, inFile multipart.File) (buf []byte, myerr error)
MarshalXls трансформировать произвольную структуру в 'xls'
func (*Service) PopulateAllEntityCache ¶
func (*Service) PopulateEntityCache ¶
func (*Service) RegisterStorage ¶
func (*Service) RegisterStorages ¶
func (*Service) Select ¶
func (s *Service) Select(ctx context.Context, requestID uint64, entity *_meta.Entity, options *_meta.Options, cascadeUp int, cascadeDown int, key *_meta.Key, keyArgs ...interface{}) (exists bool, rowsOut *_meta.Object, err error, errors _err.Errors)
Select извлечь данные в slice - только запрошенные поля
func (*Service) SelectMarshal ¶
func (s *Service) SelectMarshal(ctx context.Context, entityName string, inFormat string, queryOptions _meta.QueryOptions) (exists bool, outBuf []byte, outFormat string, err error, errors _err.Errors)
SelectMarshal извлечь данные и преобразовать в JSON / XML / YAML / XLS
func (*Service) SetOptionToCache ¶
Source Files ¶
- apiservice.go
- apiservice_cache.go
- apiservice_entity_convert.go
- apiservice_entity_create.go
- apiservice_entity_embed_error.go
- apiservice_entity_expr_calc.go
- apiservice_entity_expr_filter.go
- apiservice_entity_get.go
- apiservice_entity_persist.go
- apiservice_entity_process_association.go
- apiservice_entity_process_compositions.go
- apiservice_entity_process_get.go
- apiservice_entity_process_marshal.go
- apiservice_entity_process_persist.go
- apiservice_entity_process_post.go
- apiservice_entity_select.go
- apiservice_entity_xls.go
- apiservice_marshal.go
- apiservice_marshal_xls.go
- apiservice_meta_create.go
- apiservice_meta_get.go
- apiservice_meta_update.go
- apiservice_options.go
- apiservice_reflect.go
- apiservice_test_convert_case1.go
- apiservice_test_convert_case2.go
- apiservice_unmarshal.go
- apiservice_util.go
Click to show internal directories.
Click to hide internal directories.