Version: v0.0.0-...-b45a7ae Latest Latest

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

Go to latest
Published: Jul 3, 2020 License: Apache-2.0 Imports: 18 Imported by: 0



Package storage provides database-independent structured records persistence



This section is empty.


This section is empty.


This section is empty.


type ModelInstance

type ModelInstance struct {
	// contains filtered or unexported fields

func (*ModelInstance) GetAllAttributes

func (e *ModelInstance) GetAllAttributes() map[string]interface{}

func (*ModelInstance) GetId

func (e *ModelInstance) GetId() int64

func (*ModelInstance) GetTableName

func (e *ModelInstance) GetTableName() string

func (*ModelInstance) SetAttribute

func (e *ModelInstance) SetAttribute(name string, value interface{})

func (*ModelInstance) SetId

func (e *ModelInstance) SetId(id int64)

type ModelInstanceDAO

type ModelInstanceDAO struct {
	// contains filtered or unexported fields

func (*ModelInstanceDAO) DeleteAll

func (r *ModelInstanceDAO) DeleteAll(name string)

func (*ModelInstanceDAO) Find

func (r *ModelInstanceDAO) Find(table_name string) ([]*ModelInstance, error)

func (*ModelInstanceDAO) FindByQuery

func (r *ModelInstanceDAO) FindByQuery(table_name string, query string, params []interface{}, orderBy []query.OrderClause) ([]*ModelInstance, error)

func (*ModelInstanceDAO) Get

func (r *ModelInstanceDAO) Get(table_name string, id int64) (*ModelInstance, error)

TODO: maybe support passing ModelInstanceFactory deserializing directly into custom structure, without immediate ModelInstace

func (*ModelInstanceDAO) Remove

func (r *ModelInstanceDAO) Remove(tableName string, id int64) error

func (*ModelInstanceDAO) Store

func (r *ModelInstanceDAO) Store(entity *ModelInstance) error

type ModelInstanceFactory

type ModelInstanceFactory struct {
	// contains filtered or unexported fields

func (*ModelInstanceFactory) CreateFromMap

func (factory *ModelInstanceFactory) CreateFromMap(tableName string, values map[string]interface{}) *ModelInstance

type Storage

type Storage struct {
	// contains filtered or unexported fields

func NewStorage

func NewStorage(options StorageOpenOptions) *Storage

func (*Storage) GetEntityTypes

func (s *Storage) GetEntityTypes() map[string]*model.Model

func (*Storage) GetFileStorage

func (s *Storage) GetFileStorage(name string) filestorage.FileStorage

func (*Storage) GetModelInstanceDAO

func (s *Storage) GetModelInstanceDAO() *ModelInstanceDAO

func (*Storage) GetModelInstanceFactory

func (s *Storage) GetModelInstanceFactory() *ModelInstanceFactory

func (*Storage) GetStorageSchemaManager

func (s *Storage) GetStorageSchemaManager() *StorageSchemaManager

func (*Storage) RegisterFileStorage

func (s *Storage) RegisterFileStorage(name string, path string)

type StorageOpenOptions

type StorageOpenOptions struct {
	DB           *sqlx.DB
	FileStorages map[string]string

	EnableDevelopmentAutoMigration bool

type StorageSchemaManager

type StorageSchemaManager struct {
	// contains filtered or unexported fields

TODO: "manager" is considered to be an anti-pattern for naming, as "manager" can mean pretty much anything

func (*StorageSchemaManager) Migrate

func (manager *StorageSchemaManager) Migrate(schema model.ModelSchema) error


Path Synopsis

Jump to

Keyboard shortcuts

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