Documentation ¶
Index ¶
- Variables
- type Column
- type ColumnConfiguration
- type Configuration
- type JSONLoader
- type Loader
- type Table
- func (t *Table) AddColumn(column Column) error
- func (t *Table) AddColumns(columns ...Column) error
- func (t *Table) Alias() string
- func (t *Table) ColumnName(field string) (string, error)
- func (t *Table) ColumnNames() []string
- func (t *Table) Columns() []Column
- func (t *Table) FieldName(name string) (string, error)
- func (t *Table) Name() string
- func (t *Table) SetAlias(alias string)
- func (t *Table) SetName(name string)
- func (t *Table) SetType(entity interface{})
- func (t *Table) SetTypeName(typeName string)
- func (t *Table) TypeName() string
- type TableConfiguration
- type YAMLLoader
Constants ¶
This section is empty.
Variables ¶
var Loaders = map[string]Loader{ "yaml": YAMLLoader{}, "yml": YAMLLoader{}, "json": JSONLoader{}, }
Loaders is the collection of loaders by file extension.
Functions ¶
This section is empty.
Types ¶
type Column ¶
type Column struct {
// contains filtered or unexported fields
}
Column represents a mapping between an entity field and a database column.
type ColumnConfiguration ¶
type ColumnConfiguration struct { Name string `json:"name" yaml:"name"` Field string `json:"field" yaml:"field"` }
ColumnConfiguration represents the configuration used to construct a single column mapping.
type Configuration ¶
type Configuration struct {
Tables []TableConfiguration `json:"tables" yaml:"tables"`
}
Configuration represents the configuration used to construct the table and column mappings.
func Load ¶
func Load(path string) (Configuration, error)
Load loads the configuration from the provided file.
func (Configuration) AsMetadata ¶
func (c Configuration) AsMetadata() []Table
AsMetadata converts the configuration to metadata mappings.
type JSONLoader ¶
type JSONLoader struct{}
func (JSONLoader) Load ¶
func (l JSONLoader) Load(path string) (c Configuration, err error)
Load loads the configuration from the JSON file provided.
type Loader ¶
type Loader interface {
Load(path string) (Configuration, error)
}
Loader loads the cofiguration from the provided file.
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
Table represents a mapping between an entity and a database table.
func (*Table) AddColumns ¶
AddColumns adds all of the provided columns to the table.
func (*Table) ColumnName ¶
ColumnName retrieves the column name associated to the provide field name.
func (*Table) ColumnNames ¶
ColumnNames retrieves all of the column names for the table.
func (*Table) FieldName ¶
FieldName retrieves the field name associated to the provided column name.
func (*Table) SetType ¶
func (t *Table) SetType(entity interface{})
SetType associates the entity type to the table.
func (*Table) SetTypeName ¶
SetTypeName modifies the entity type name for the table.
type TableConfiguration ¶
type TableConfiguration struct { TypeName string `json:"typeName" yaml:"typeName"` Name string `json:"name" yaml:"name"` Alias string `json:"alias" yaml:"alias"` Columns []ColumnConfiguration `json:"columns" yaml:"columns"` }
TableConfiguration represents the configuration used to construct a single table mapping.
type YAMLLoader ¶
type YAMLLoader struct{}
func (YAMLLoader) Load ¶
func (l YAMLLoader) Load(path string) (c Configuration, err error)
Load loads the configuration from the YAML file provided.