Documentation ¶
Index ¶
- Constants
- Variables
- func AddEntity(table *Table)
- func SubstituteNamedParameters(parsedSql *ParsedSql, translator Translator) string
- func TmWithDbFactory(dbFactory func(dbx.IConnection, Mapper) IDb) func(*TransactionManager)
- type AliasBag
- type Association
- func (a *Association) As(alias string) *Association
- func (a *Association) Clone() interface{}
- func (a *Association) Equals(o interface{}) bool
- func (a *Association) GenericPath() string
- func (a *Association) GetAliasFrom() string
- func (a *Association) GetAliasTo() string
- func (a *Association) GetDiscriminatorTable() *Table
- func (a *Association) GetDiscriminators() []Discriminator
- func (a *Association) GetRelations() []Relation
- func (a *Association) GetTableFrom() *Table
- func (a *Association) GetTableMany2Many() *Table
- func (a *Association) GetTableTo() *Table
- func (a *Association) HashCode() int
- func (a *Association) IsMany2Many() bool
- func (a *Association) Path() string
- func (a *Association) SetAliasFrom(aliasFrom string)
- func (a *Association) SetAliasTo(aliasTo string)
- func (a *Association) SetDiscriminators(discriminators ...Discriminator)
- func (a *Association) String() string
- func (a *Association) With(column *Column, value interface{}) *Association
- type AutoKeyStrategy
- type ColGroup
- type Column
- func (c *Column) As(alias string) *Column
- func (c *Column) Clone() interface{}
- func (c *Column) Deletion() *Column
- func (c *Column) Different(value interface{}) *Criteria
- func (c *Column) Equals(o interface{}) bool
- func (c *Column) For(tableAlias string) *ColumnHolder
- func (c *Column) GetAlias() string
- func (c *Column) GetName() string
- func (c *Column) GetTable() *Table
- func (c *Column) Greater(value interface{}) *Criteria
- func (c *Column) GreaterOrMatch(value interface{}) *Criteria
- func (c *Column) HashCode() int
- func (c *Column) ILike(right interface{}) *Criteria
- func (c *Column) IMatches(value interface{}) *Criteria
- func (c *Column) In(value ...interface{}) *Criteria
- func (c *Column) IsDeletion() bool
- func (c *Column) IsKey() bool
- func (c *Column) IsMandatory() bool
- func (c *Column) IsNull() *Criteria
- func (c *Column) IsVersion() bool
- func (c *Column) Key() *Column
- func (c *Column) Lesser(value interface{}) *Criteria
- func (c *Column) LesserOrMatch(value interface{}) *Criteria
- func (c *Column) Like(right interface{}) *Criteria
- func (c *Column) Mandatory() *Column
- func (c *Column) Matches(value interface{}) *Criteria
- func (c *Column) Range(left, right interface{}) *Criteria
- func (c *Column) String() string
- func (c *Column) Version() *Column
- type ColumnHolder
- func (c *ColumnHolder) As(alias string) *ColumnHolder
- func (c *ColumnHolder) Clone() interface{}
- func (c *ColumnHolder) Equals(o interface{}) bool
- func (c *ColumnHolder) For(tableAlias string) *ColumnHolder
- func (c *ColumnHolder) GetAlias() string
- func (c *ColumnHolder) GetColumn() *Column
- func (c *ColumnHolder) HashCode() int
- func (c *ColumnHolder) SetTableAlias(tableAlias string)
- type Converter
- type Crawler
- type CrawlerNode
- type Criteria
- func And(operations ...*Criteria) *Criteria
- func BoundedValueRange(bottom, top interface{}, value Tokener) *Criteria
- func Different(left, right interface{}) *Criteria
- func Exists(token interface{}) *Criteria
- func Greater(left, right interface{}) *Criteria
- func GreaterOrMatch(left, right interface{}) *Criteria
- func ILike(left, right interface{}) *Criteria
- func IMatches(left, right interface{}) *Criteria
- func In(column interface{}, values ...interface{}) *Criteria
- func IsNull(token interface{}) *Criteria
- func Lesser(left, right interface{}) *Criteria
- func LesserOrMatch(left, right interface{}) *Criteria
- func Like(left, right interface{}) *Criteria
- func Matches(left, right interface{}) *Criteria
- func NewCriteria(operator string, members ...interface{}) *Criteria
- func Not(token interface{}) *Criteria
- func Or(operations ...*Criteria) *Criteria
- func Range(receiver, bottom, top interface{}) *Criteria
- func ValueRange(bottom, top interface{}, value Tokener) *Criteria
- func (c *Criteria) And(criteria *Criteria) *Criteria
- func (c *Criteria) Clone() interface{}
- func (c *Criteria) GetLeft() Tokener
- func (c *Criteria) GetRight() Tokener
- func (c *Criteria) Not() *Criteria
- func (c *Criteria) Or(criteria *Criteria) *Criteria
- func (c *Criteria) SetLeft(left interface{})
- func (c *Criteria) SetRight(right interface{})
- type Db
- func (d *Db) Create(instance interface{}) error
- func (d *Db) Delete(table *Table) *Delete
- func (d *Db) FindAll(instance interface{}, example interface{}) error
- func (d *Db) FindFirst(instance interface{}, example interface{}) (bool, error)
- func (d *Db) GetAttribute(key string) (interface{}, bool)
- func (d *Db) GetConnection() dbx.IConnection
- func (d *Db) GetContext() context.Context
- func (d *Db) GetTranslator() Translator
- func (d *Db) Insert(table *Table) *Insert
- func (d *Db) Modify(instance interface{}) (bool, error)
- func (d *Db) PopulateMapping(prefix string, typ reflect.Type) (map[string]*EntityProperty, error)
- func (d *Db) Query(table *Table) *Query
- func (d *Db) Remove(instance interface{}) (bool, error)
- func (d *Db) RemoveAll(instance interface{}) (int64, error)
- func (d *Db) Retrieve(instance interface{}, keys ...interface{}) (bool, error)
- func (d *Db) Save(instance interface{}) (bool, error)
- func (d *Db) SetAttribute(key string, value interface{})
- func (d *Db) Update(table *Table) *Update
- func (d *Db) WithContext(ctx context.Context) IDb
- type Delete
- type Discriminator
- type DmlBase
- func (d *DmlBase) GetAliasForAssociation(association *Association) string
- func (d *DmlBase) GetCriteria() *Criteria
- func (d *DmlBase) GetDb() IDb
- func (d *DmlBase) GetDba() *dbx.SimpleDBA
- func (d *DmlBase) GetJoins() []*Join
- func (d *DmlBase) GetParameter(column *Column) interface{}
- func (d *DmlBase) GetParameters() map[string]interface{}
- func (d *DmlBase) GetTable() *Table
- func (d *DmlBase) GetTableAlias() string
- func (d *DmlBase) NextRawIndex() int
- func (d *DmlBase) SetParameter(key string, parameter interface{})
- func (d *DmlBase) SetParameterFor(col *Column, parameter interface{})
- func (d *DmlBase) SetTableAlias(alias string)
- type DmlCore
- type DmlType
- type EntityProperty
- func (bp *EntityProperty) ConvertFromDb(value interface{}) (interface{}, error)
- func (bp *EntityProperty) ConvertToDb(value interface{}) (interface{}, error)
- func (e *EntityProperty) Get(instance reflect.Value) reflect.Value
- func (e *EntityProperty) IsMany() bool
- func (e *EntityProperty) New() interface{}
- func (e *EntityProperty) Set(instance reflect.Value, value reflect.Value) bool
- type EntityTransformer
- func (e *EntityTransformer) AfterAll(result coll.Collection)
- func (e *EntityTransformer) BeforeAll() coll.Collection
- func (e *EntityTransformer) DiscardIfKeyIsNull() bool
- func (e *EntityTransformer) InitRowData(row []interface{}, properties map[string]*EntityProperty)
- func (e *EntityTransformer) OnTransformation(result coll.Collection, instance interface{})
- func (e *EntityTransformer) PopulateMapping(tableAlias string, typ reflect.Type) (map[string]*EntityProperty, error)
- func (e *EntityTransformer) ToEntity(row []interface{}, instance reflect.Value, ...) (bool, error)
- func (e *EntityTransformer) Transform(rows *sql.Rows) (interface{}, error)
- type EntityTransformerOverrider
- type EntityTreeTransformer
- func (e *EntityTreeTransformer) AfterAll(result coll.Collection)
- func (e *EntityTreeTransformer) BeforeAll() coll.Collection
- func (e *EntityTreeTransformer) DiscardIfKeyIsNull() bool
- func (e *EntityTreeTransformer) ForwardBranches() []*Association
- func (e *EntityTreeTransformer) InitFullRowData(row []interface{}, typ reflect.Type, alias string) error
- func (e *EntityTreeTransformer) LoadInstanceKeys(row []interface{}, ptr reflect.Value, properties map[string]*EntityProperty, ...) (bool, error)
- func (e *EntityTreeTransformer) OnTransformation(result coll.Collection, instance interface{})
- func (e *EntityTreeTransformer) Transform(rows *sql.Rows) (interface{}, error)
- type Group
- type HoldTable
- type HollowTransactionManager
- type IDb
- type ITransactionManager
- type Insert
- func (i *Insert) Alias(alias string) *Insert
- func (i *Insert) Columns(columns ...*Column) *Insert
- func (i *Insert) Execute() (int64, error)
- func (i *Insert) ReturnId(returnId bool) *Insert
- func (i *Insert) Set(col *Column, value interface{}) *Insert
- func (i *Insert) Submit(instance interface{}) (int64, error)
- func (i *Insert) Values(vals ...interface{}) *Insert
- type Join
- type Mapper
- type Markable
- type Marker
- type MyTx
- type NoTx
- type Order
- type ParsedSql
- type PathCriteria
- type PathElement
- type PostDeleter
- type PostInserter
- type PostRetriever
- type PostUpdater
- type PreDeleter
- type PreInserter
- type PreUpdater
- type Query
- func (q *Query) Alias(alias string) *Query
- func (q *Query) All() *Query
- func (q *Query) As(alias string) *Query
- func (q *Query) Asc() *Query
- func (q *Query) Column(columns ...interface{}) *Query
- func (q *Query) ColumnsReset()
- func (q *Query) Copy(other *Query)
- func (q *Query) Count(column interface{}) *Query
- func (q *Query) CountAll() *Query
- func (q *Query) Desc() *Query
- func (q *Query) Dir(asc bool) *Query
- func (q *Query) Distinct() *Query
- func (q *Query) Fetch() *Query
- func (q *Query) GetGroupBy() []int
- func (q *Query) GetGroupByTokens() []Group
- func (q *Query) GetHaving() *Criteria
- func (q *Query) GetLimit() int64
- func (q *Query) GetOrders() []*Order
- func (q *Query) GetSkip() int64
- func (q *Query) GetSubQuery() *Query
- func (q *Query) GetSubQueryAlias() string
- func (q *Query) GetUnions() []*Union
- func (q *Query) GroupBy(cols ...*Column) *Query
- func (q *Query) GroupByAs(aliases ...string) *Query
- func (q *Query) GroupByPos(pos ...int) *Query
- func (q *Query) GroupByUntil(untilPos int) *Query
- func (q *Query) Having(having ...*Criteria) *Query
- func (q *Query) Include(columns ...interface{}) *Query
- func (q *Query) Inner(associations ...*Association) *Query
- func (q *Query) IsDistinct() bool
- func (q *Query) Join() *Query
- func (q *Query) Limit(limit int64) *Query
- func (q *Query) List(target interface{}) error
- func (q *Query) ListFlatTree(target interface{}) error
- func (q *Query) ListFlatTreeOf(template interface{}) (coll.Collection, error)
- func (q *Query) ListInto(closure interface{}) ([]interface{}, error)
- func (q *Query) ListOf(template interface{}) (coll.Collection, error)
- func (q *Query) ListSimple(closure func(), instances ...interface{}) error
- func (q *Query) ListTreeOf(template tk.Hasher) (coll.Collection, error)
- func (q *Query) On(criteria ...*Criteria) *Query
- func (q *Query) Order(column *Column) *Query
- func (q *Query) OrderAs(columnHolder *ColumnHolder) *Query
- func (q *Query) OrderBy(column *Column) *Query
- func (q *Query) OrderByAs(column string) *Query
- func (q *Query) OrderOn(column *Column, associations ...*Association) *Query
- func (q *Query) OrdersReset()
- func (q *Query) Outer(associations ...*Association) *Query
- func (q *Query) SelectFlatTree(instance interface{}) (bool, error)
- func (q *Query) SelectInto(dest ...interface{}) (bool, error)
- func (q *Query) SelectTo(instance interface{}) (bool, error)
- func (q *Query) SelectTree(instance tk.Hasher) (bool, error)
- func (q *Query) Skip(skip int64) *Query
- func (q *Query) Union(query *Query) *Query
- func (q *Query) UnionAll(query *Query) *Query
- func (q *Query) Where(restriction ...*Criteria) *Query
- type RawSql
- type Relashionships
- type Relation
- type SearchedCase
- type SearchedWhen
- type SimpleCase
- type SimpleWhen
- type StructProperty
- type Table
- func (t *Table) ASSOCIATE(from ...*Column) ColGroup
- func (t *Table) ASSOCIATION(from *Column, to *Column) *Association
- func (t *Table) AddAssociation(fk *Association) *Association
- func (t *Table) AddAssociationAs(name string, fk *Association) *Association
- func (t *Table) As(alias string) *Table
- func (t *Table) COLUMN(name string) *Column
- func (t *Table) DELETION(name string) *Column
- func (t *Table) Equals(obj interface{}) bool
- func (t *Table) GetAssociations() []*Association
- func (t *Table) GetBasicColumns() coll.Collection
- func (t *Table) GetColumns() coll.Collection
- func (t *Table) GetCriterias() []*Criteria
- func (t *Table) GetDeletionColumn() *Column
- func (t *Table) GetDiscriminators() []Discriminator
- func (t *Table) GetKeyColumns() coll.Collection
- func (t *Table) GetName() string
- func (t *Table) GetSingleKeyColumn() *Column
- func (t *Table) GetVersionColumn() *Column
- func (t *Table) KEY(name string) *Column
- func (t *Table) String() string
- func (t *Table) VERSION(name string) *Column
- func (t *Table) With(column string, value interface{}) *Table
- type TableNamer
- type Token
- func Add(values ...interface{}) *Token
- func Alias(s string) *Token
- func AsIs(o interface{}) *Token
- func Coalesce(values ...interface{}) *Token
- func Count(column interface{}) *Token
- func Lower(token interface{}) *Token
- func Max(token interface{}) *Token
- func Min(token interface{}) *Token
- func Minus(values ...interface{}) *Token
- func Multiply(values ...interface{}) *Token
- func NewEndToken(operator string, o interface{}) *Token
- func NewToken(operator string, members ...interface{}) *Token
- func Null() *Token
- func Param(str string) *Token
- func Raw(o interface{}) *Token
- func Rtrim(token interface{}) *Token
- func SubQuery(sq *Query) *Token
- func Sum(token interface{}) *Token
- func Upper(token interface{}) *Token
- func (t *Token) Clone() interface{}
- func (t *Token) Different(value interface{}) *Criteria
- func (t *Token) Equals(o interface{}) bool
- func (t *Token) GetAlias() string
- func (t *Token) GetMembers() []Tokener
- func (t *Token) GetOperator() string
- func (t *Token) GetPseudoTableAlias() string
- func (t *Token) GetTableAlias() string
- func (t *Token) GetValue() interface{}
- func (t *Token) Greater(value interface{}) *Criteria
- func (t *Token) GreaterOrMatch(value interface{}) *Criteria
- func (t *Token) HashCode() int
- func (t *Token) ILike(right interface{}) *Criteria
- func (t *Token) IMatches(value interface{}) *Criteria
- func (t *Token) IsNil() bool
- func (t *Token) IsNull() *Criteria
- func (t *Token) Lesser(value interface{}) *Criteria
- func (t *Token) LesserOrMatch(value interface{}) *Criteria
- func (t *Token) Like(right interface{}) *Criteria
- func (t *Token) Matches(value interface{}) *Criteria
- func (t *Token) SetAlias(alias string)
- func (t *Token) SetMembers(members ...Tokener)
- func (t *Token) SetOperator(operator string)
- func (t *Token) SetPseudoTableAlias(pseudoTableAlias string)
- func (t *Token) SetTableAlias(tableAlias string)
- func (t *Token) SetValue(value interface{})
- func (t *Token) String() string
- type Tokener
- type TransactionManager
- func (t *TransactionManager) Mappings(typ reflect.Type) (map[string]*StructProperty, error)
- func (t *TransactionManager) NoTransaction(handler func(db IDb) error) error
- func (d *TransactionManager) RegisterType(v interface{}) error
- func (t *TransactionManager) Store() IDb
- func (t *TransactionManager) Transaction(handler func(db IDb) error) error
- func (t *TransactionManager) With(db IDb) ITransactionManager
- type Translator
- type Union
- type Update
- func (u *Update) Alias(alias string) *Update
- func (u *Update) Columns(columns ...*Column) *Update
- func (u *Update) Execute() (int64, error)
- func (u *Update) Set(col *Column, value interface{}) *Update
- func (u *Update) Submit(instance interface{}) (int64, error)
- func (u *Update) Values(vals ...interface{}) *Update
- func (u *Update) Where(restriction ...*Criteria) *Update
Constants ¶
const ( OFFSET_PARAM = "OFFSET_PARAM" LIMIT_PARAM = "LIMIT_PARAM" )
const FK_NAV_SEP = "."
const JOIN_PREFIX = "j"
const PARAMETER_SEPARATORS = `"':&,;()|=+-*%/\<>^`
Set of characters that qualify as parameter separators, indicating that a parameter name in a SQL String has ended.
const PREFIX = "t"
Variables ¶
var ( OPTIMISTIC_LOCK_MSG = "No update was possible for this version of the data. Data may have changed." VERSION_SET_MSG = "Unable to set Version data." )
var START_SKIP = []string{"'", "\"", "--", "/*"}
Set of characters that qualify as comment or quotes starting characters.
var STOP_SKIP = []string{"'", "\"", "\n", "*/"}
Set of characters that at are the corresponding comment or quotes ending characters.
var TOKEN_ADD = "ADD"
var TOKEN_ALIAS = "ALIAS"
var TOKEN_AND = "AND"
var TOKEN_ASIS = "VAL" // value is injected to the SQL as is.
var TOKEN_BOUNDEDRANGE = "BOUNDEDRANGE"
var TOKEN_CASE = "CASE"
var TOKEN_CASE_ELSE = "CASE_ELSE"
var TOKEN_CASE_WHEN = "CASE_WHEN"
var TOKEN_COALESCE = "COALESCE"
var TOKEN_COLUMN = "COLUMN"
var TOKEN_COUNT = "COUNT" // COUNT(*)
var TOKEN_COUNT_COLUMN = "COUNT_COLUMN" // COUNT(COLUMN)
var TOKEN_DIVIDE = "DIVIDE"
var TOKEN_EQ = "EQ"
CONDITIONS
var TOKEN_EXISTS = "EXISTS"
var TOKEN_GT = "GT"
var TOKEN_GTEQ = "GTEQ"
var TOKEN_IEQ = "IEQ"
var TOKEN_IGT = "IGT"
var TOKEN_IGTEQ = "IGTEQ"
var TOKEN_ILIKE = "ILIKE"
var TOKEN_ILT = "ILT"
var TOKEN_ILTEQ = "ILTEQ"
var TOKEN_IN = "IN"
var TOKEN_ISNULL = "ISNULL"
var TOKEN_LIKE = "LIKE"
var TOKEN_LOWER = "LOWER"
var TOKEN_LT = "LT"
var TOKEN_LTEQ = "LTEQ"
var TOKEN_MAX = "MAX"
var TOKEN_MIN = "MIN"
var TOKEN_MINUS = "MINUS"
var TOKEN_MULTIPLY = "MULTIPLY"
var TOKEN_NEQ = "NEQ"
var TOKEN_NOT = "NOT"
var TOKEN_NULL = "NULL" // sets a predefined value
var TOKEN_OR = "OR"
var TOKEN_PARAM = "PARAM" // parameter
FUNCTIONS
var TOKEN_RANGE = "RANGE"
var TOKEN_RAW = "RAW" // sets a predefined value
var TOKEN_RTRIM = "RTRIM"
var TOKEN_SUBQUERY = "SUBQUERY"
var TOKEN_SUM = "SUM"
var TOKEN_UPPER = "UPPER"
var TOKEN_VALUERANGE = "VALUERANGE"
var Tables = coll.NewLinkedHashMap()
entity mapping
Functions ¶
func SubstituteNamedParameters ¶
func SubstituteNamedParameters(parsedSql *ParsedSql, translator Translator) string
Parse the SQL statement and locate any placeholders or named parameters. Named parameters are substituted for a '?' placeholder
param parsedSql
the parsed represenation of the SQL statement
param paramSource
the source for named parameters
return the SQL statement with substituted parameters see #parseSqlStatement
func TmWithDbFactory ¶ added in v1.5.0
func TmWithDbFactory(dbFactory func(dbx.IConnection, Mapper) IDb) func(*TransactionManager)
Types ¶
type AliasBag ¶
type AliasBag struct {
// contains filtered or unexported fields
}
This struct gives the SAME alias when traversing the JOINS
Note: two lists of joins (a path), they have diferent FK alias from the moment they differ
func NewAliasBag ¶
func (*AliasBag) GetAlias ¶
func (a *AliasBag) GetAlias(fk *Association) string
func (*AliasBag) Has ¶
func (a *AliasBag) Has(fk *Association) bool
func (*AliasBag) SetAlias ¶
func (a *AliasBag) SetAlias(fk *Association, alias string)
type Association ¶
type Association struct { FromM2M *Association ToM2M *Association Alias string // contains filtered or unexported fields }
func NewAssociation ¶
func NewAssociation(relations ...Relation) *Association
func NewAssociationAs ¶
func NewAssociationAs(name string, relations ...Relation) *Association
func NewAssociationCopy ¶
func NewAssociationCopy(fk *Association) *Association
func NewM2MAssociation ¶
func NewM2MAssociation(alias string, fkFrom *Association, fkTo *Association) *Association
Creates a many to many association by using the relations defined in each association
func (*Association) As ¶
func (a *Association) As(alias string) *Association
func (*Association) Clone ¶
func (a *Association) Clone() interface{}
func (*Association) Equals ¶
func (a *Association) Equals(o interface{}) bool
func (*Association) GenericPath ¶
func (a *Association) GenericPath() string
func (*Association) GetAliasFrom ¶
func (a *Association) GetAliasFrom() string
func (*Association) GetAliasTo ¶
func (a *Association) GetAliasTo() string
func (*Association) GetDiscriminatorTable ¶
func (a *Association) GetDiscriminatorTable() *Table
func (*Association) GetDiscriminators ¶
func (a *Association) GetDiscriminators() []Discriminator
func (*Association) GetRelations ¶
func (a *Association) GetRelations() []Relation
func (*Association) GetTableFrom ¶
func (a *Association) GetTableFrom() *Table
func (*Association) GetTableMany2Many ¶
func (a *Association) GetTableMany2Many() *Table
func (*Association) GetTableTo ¶
func (a *Association) GetTableTo() *Table
func (*Association) HashCode ¶
func (a *Association) HashCode() int
func (*Association) IsMany2Many ¶
func (a *Association) IsMany2Many() bool
func (*Association) Path ¶
func (a *Association) Path() string
func (*Association) SetAliasFrom ¶
func (a *Association) SetAliasFrom(aliasFrom string)
func (*Association) SetAliasTo ¶
func (a *Association) SetAliasTo(aliasTo string)
func (*Association) SetDiscriminators ¶
func (a *Association) SetDiscriminators(discriminators ...Discriminator)
func (*Association) String ¶
func (a *Association) String() string
func (*Association) With ¶
func (a *Association) With(column *Column, value interface{}) *Association
type AutoKeyStrategy ¶
type AutoKeyStrategy int
const ( AUTOKEY_NONE AutoKeyStrategy = iota AUTOKEY_BEFORE AUTOKEY_RETURNING AUTOKEY_AFTER )
type ColGroup ¶
type ColGroup struct {
// contains filtered or unexported fields
}
func (ColGroup) TO ¶
func (cg ColGroup) TO(to ...*Column) Relashionships
func (ColGroup) WITH ¶
func (cg ColGroup) WITH(to ...*Column) *Association
type Column ¶
type Column struct {
// contains filtered or unexported fields
}
func (*Column) For ¶
func (c *Column) For(tableAlias string) *ColumnHolder
Defines the table alias for this column in the SQL
func (*Column) GreaterOrMatch ¶
func (*Column) IsDeletion ¶
func (*Column) IsMandatory ¶
func (*Column) LesserOrMatch ¶
type ColumnHolder ¶
type ColumnHolder struct { Token // contains filtered or unexported fields }
can hold a Column, a Token or any constante
func Col ¶
func Col(column *Column) *ColumnHolder
func NewColumnHolder ¶
func NewColumnHolder(column *Column) *ColumnHolder
func (*ColumnHolder) As ¶
func (c *ColumnHolder) As(alias string) *ColumnHolder
func (*ColumnHolder) Clone ¶
func (c *ColumnHolder) Clone() interface{}
func (*ColumnHolder) Equals ¶
func (c *ColumnHolder) Equals(o interface{}) bool
func (*ColumnHolder) For ¶
func (c *ColumnHolder) For(tableAlias string) *ColumnHolder
func (*ColumnHolder) GetAlias ¶
func (c *ColumnHolder) GetAlias() string
func (*ColumnHolder) GetColumn ¶
func (c *ColumnHolder) GetColumn() *Column
func (*ColumnHolder) HashCode ¶
func (c *ColumnHolder) HashCode() int
func (*ColumnHolder) SetTableAlias ¶
func (c *ColumnHolder) SetTableAlias(tableAlias string)
type Converter ¶
type Converter interface { ToDb(in interface{}) (interface{}, error) FromDbInstance() interface{} FromDb(in interface{}) (interface{}, error) }
Converter converts the data stored in the database into the data stored in the struct and vice-versa
type Crawler ¶
type Crawler struct {
// contains filtered or unexported fields
}
The objective of this structure is to maintain state, while crawling the associations and building the entity tree, after an sql select This way it is possible to hint the row transformers wich paths to follow. While crawling the associations of a query result the list of possible paths changes.
The process has 2 steps:
- building a tree (common foreign keys are converted into one) to identify wich branches exist for a node
- building an array that only has the edge nodes of a tree (tree contour) to ease the computation of the column offsets of each processed entity
func (*Crawler) GetBranches ¶
func (c *Crawler) GetBranches() []*CrawlerNode
type CrawlerNode ¶
type CrawlerNode struct { ForeignKey *Association // contains filtered or unexported fields }
func (*CrawlerNode) BuildTree ¶
func (c *CrawlerNode) BuildTree(fks []*Association, table *HoldTable)
To guarantee that the several joins are chained and assessed correctly a tree is built only for validation
func (*CrawlerNode) FlatenTree ¶
func (c *CrawlerNode) FlatenTree(flat []*CrawlerNode) []*CrawlerNode
builds an array with all the tree nodes by entry order param: flat
func (*CrawlerNode) GetBranches ¶
func (c *CrawlerNode) GetBranches() []*CrawlerNode
func (*CrawlerNode) String ¶
func (c *CrawlerNode) String() string
type Criteria ¶
* Criteria
func BoundedValueRange ¶
func GreaterOrMatch ¶
func GreaterOrMatch(left, right interface{}) *Criteria
func LesserOrMatch ¶
func LesserOrMatch(left, right interface{}) *Criteria
func NewCriteria ¶
func ValueRange ¶
type Db ¶
type Db struct { Connection dbx.IConnection Translator Translator // contains filtered or unexported fields }
func NewDb ¶
func NewDb(connection dbx.IConnection, translator Translator, cacher Mapper) *Db
func (*Db) Delete ¶
the idea is to centralize the query creation so that future customization could be made
func (*Db) GetAttribute ¶
func (*Db) GetConnection ¶
func (d *Db) GetConnection() dbx.IConnection
func (*Db) GetContext ¶ added in v1.5.0
func (*Db) GetTranslator ¶
func (d *Db) GetTranslator() Translator
func (*Db) Insert ¶
the idea is to centralize the query creation so that future customization could be made
func (*Db) PopulateMapping ¶ added in v1.4.2
func (*Db) Query ¶
the idea is to centralize the query creation so that future customization could be made
func (*Db) RemoveAll ¶
removes all that match the criteria defined by the non zero values by the struct.
func (*Db) Save ¶
Inserts or Updates a record depending on the value of the Version.
If version is nil or zero, an insert is issue, otherwise an update. If there is no version column it returns an error.
func (*Db) SetAttribute ¶
type Discriminator ¶
func NewDiscriminator ¶
func NewDiscriminator(column *Column, value Tokener) Discriminator
func (Discriminator) Criteria ¶
func (d Discriminator) Criteria() *Criteria
type DmlBase ¶
type DmlBase struct {
// contains filtered or unexported fields
}
func NewDmlBase ¶
func (*DmlBase) GetAliasForAssociation ¶
func (d *DmlBase) GetAliasForAssociation(association *Association) string
func (*DmlBase) GetCriteria ¶
func (*DmlBase) GetParameter ¶
func (*DmlBase) GetParameters ¶
func (*DmlBase) GetTableAlias ¶
func (*DmlBase) NextRawIndex ¶
func (*DmlBase) SetParameter ¶
func (*DmlBase) SetParameterFor ¶
Sets the value of parameter to the column param col: The column param parameter: The value to set
func (*DmlBase) SetTableAlias ¶
type EntityProperty ¶
type EntityProperty struct { StructProperty Position int Key bool }
func (*EntityProperty) ConvertFromDb ¶
func (bp *EntityProperty) ConvertFromDb(value interface{}) (interface{}, error)
func (*EntityProperty) ConvertToDb ¶
func (bp *EntityProperty) ConvertToDb(value interface{}) (interface{}, error)
func (*EntityProperty) IsMany ¶
func (e *EntityProperty) IsMany() bool
func (*EntityProperty) New ¶
func (e *EntityProperty) New() interface{}
type EntityTransformer ¶
type EntityTransformer struct { Overrider EntityTransformerOverrider Query *Query Factory func() reflect.Value Returner func(val reflect.Value) reflect.Value Properties map[string]*EntityProperty TemplateData []interface{} }
func NewEntityTransformer ¶
func NewEntityTransformer(query *Query, instance interface{}) *EntityTransformer
func (*EntityTransformer) AfterAll ¶
func (e *EntityTransformer) AfterAll(result coll.Collection)
func (*EntityTransformer) BeforeAll ¶
func (e *EntityTransformer) BeforeAll() coll.Collection
func (*EntityTransformer) DiscardIfKeyIsNull ¶
func (e *EntityTransformer) DiscardIfKeyIsNull() bool
can be overriden
func (*EntityTransformer) InitRowData ¶
func (e *EntityTransformer) InitRowData( row []interface{}, properties map[string]*EntityProperty, )
func (*EntityTransformer) OnTransformation ¶
func (e *EntityTransformer) OnTransformation(result coll.Collection, instance interface{})
func (*EntityTransformer) PopulateMapping ¶
func (e *EntityTransformer) PopulateMapping(tableAlias string, typ reflect.Type) (map[string]*EntityProperty, error)
Populates the mapping with instance properties, using "tableAlias.propertyName" as key Only properties of a type present in the query are mapped param mappings: instance of Map param tableAlias: The table alias. If <code>nil</code> the mapping key is only "propertyName" param type: The entity class
func (*EntityTransformer) ToEntity ¶
func (e *EntityTransformer) ToEntity( row []interface{}, instance reflect.Value, properties map[string]*EntityProperty, emptyBean *bool, ) (bool, error)
returns if the entity was valid
type EntityTransformerOverrider ¶
type EntityTransformerOverrider interface { dbx.IRowTransformer PopulateMapping(tableAlias string, typ reflect.Type) (map[string]*EntityProperty, error) DiscardIfKeyIsNull() bool InitRowData(row []interface{}, properties map[string]*EntityProperty) ToEntity(row []interface{}, instance reflect.Value, properties map[string]*EntityProperty, emptyBean *bool) (bool, error) }
type EntityTreeTransformer ¶
type EntityTreeTransformer struct { EntityTransformer // contains filtered or unexported fields }
extends EntityTransformer
func NewEntityTreeFactoryTransformer ¶
func NewEntityTreeFactoryTransformer(query *Query, typ reflect.Type, returner func(val reflect.Value) reflect.Value) *EntityTreeTransformer
since the creation of the list is managed outside the reue flag is set to false
func NewEntityTreeTransformer ¶
func NewEntityTreeTransformer(query *Query, reuse bool, instance interface{}) *EntityTreeTransformer
func (*EntityTreeTransformer) AfterAll ¶
func (e *EntityTreeTransformer) AfterAll(result coll.Collection)
func (*EntityTreeTransformer) BeforeAll ¶
func (e *EntityTreeTransformer) BeforeAll() coll.Collection
func (*EntityTreeTransformer) DiscardIfKeyIsNull ¶
func (e *EntityTreeTransformer) DiscardIfKeyIsNull() bool
func (*EntityTreeTransformer) ForwardBranches ¶
func (e *EntityTreeTransformer) ForwardBranches() []*Association
return the list o current branches and moves forward to the next list return: the current list of branches
func (*EntityTreeTransformer) InitFullRowData ¶
func (e *EntityTreeTransformer) InitFullRowData( row []interface{}, typ reflect.Type, alias string, ) error
func (*EntityTreeTransformer) LoadInstanceKeys ¶
func (e *EntityTreeTransformer) LoadInstanceKeys( row []interface{}, ptr reflect.Value, properties map[string]*EntityProperty, onlyKeys bool, ) (bool, error)
return true if the entity is valid
func (*EntityTreeTransformer) OnTransformation ¶
func (e *EntityTreeTransformer) OnTransformation(result coll.Collection, instance interface{})
type HollowTransactionManager ¶
type HollowTransactionManager struct {
// contains filtered or unexported fields
}
func (HollowTransactionManager) NoTransaction ¶
func (t HollowTransactionManager) NoTransaction(handler func(db IDb) error) error
func (HollowTransactionManager) Store ¶
func (t HollowTransactionManager) Store() IDb
func (HollowTransactionManager) Transaction ¶
func (t HollowTransactionManager) Transaction(handler func(db IDb) error) error
func (HollowTransactionManager) With ¶
func (t HollowTransactionManager) With(db IDb) ITransactionManager
type IDb ¶
type IDb interface { PopulateMapping(prefix string, typ reflect.Type) (map[string]*EntityProperty, error) GetTranslator() Translator GetConnection() dbx.IConnection WithContext(context.Context) IDb GetContext() context.Context Query(table *Table) *Query Insert(table *Table) *Insert Delete(table *Table) *Delete Update(table *Table) *Update Create(instance interface{}) error Retrieve(instance interface{}, keys ...interface{}) (bool, error) FindFirst(instance interface{}, example interface{}) (bool, error) FindAll(instance interface{}, example interface{}) error Modify(instance interface{}) (bool, error) Remove(instance interface{}) (bool, error) RemoveAll(instance interface{}) (int64, error) Save(instance interface{}) (bool, error) // Create or Modify GetAttribute(string) (interface{}, bool) SetAttribute(string, interface{}) // general attribute. ex: user in session }
type ITransactionManager ¶
type Insert ¶
func (*Insert) ReturnId ¶
Definies if the auto key should be retrieved. Returning an Id could mean one more query execution. It returns the Id by default.
type Join ¶
type Join struct {
// contains filtered or unexported fields
}
func NewJoin ¶
func NewJoin(associations []*PathElement, fetch bool) *Join
func (Join) GetAssociations ¶
func (j Join) GetAssociations() []*Association
func (Join) GetPathElements ¶
func (j Join) GetPathElements() []*PathElement
type Mapper ¶ added in v1.5.0
type Mapper interface {
Mappings(typ reflect.Type) (map[string]*StructProperty, error)
}
type Markable ¶
type Markable interface { // Retrieve property names that were changed // // return names of the changed properties Marks() map[string]bool Unmark() }
Interface that a struct must implement to inform what columns where changed
type Order ¶
type Order struct {
// contains filtered or unexported fields
}
func NewOrder ¶
func NewOrder(column *ColumnHolder) *Order
func NewOrderAs ¶
func (*Order) GetHolder ¶
func (o *Order) GetHolder() *ColumnHolder
type ParsedSql ¶
type ParsedSql struct { Names []string // indexes for the specified parameter. Indexes [][]int // contains filtered or unexported fields }
Holds information about a parsed SQL statement.
func NewParsedSql ¶
param originalSql: the SQL statement that is being (or is to be) parsed
func ParseSqlStatement ¶
Parse the SQL statement and locate any placeholders or named parameters. Named parameters are substituted for a native placeholder.
param statement: the SQL statement return: the parsed statement, represented as ParsedSql instance
func (*ParsedSql) AddNamedParameter ¶
Add a named parameter parsed from this SQL statement.
param name: the name of the parameter param startIndex: the start index in the original SQL String param endIndex: the end index in the original SQL String
type PathCriteria ¶
type PathElement ¶
type PathElement struct { Base *Association Derived *Association Inner bool Criteria *Criteria Columns []Tokener Orders []*Order PreferredAlias string // user preferred alias }
func DeepestCommonPath ¶
func DeepestCommonPath(cachedAssociation [][]*PathElement, associations []*PathElement) []*PathElement
From the lists of Foreign Keys (paths) groups, gets the Foreign Keys matching the longest common path that is possible to traverse with the supplied Foreign Keys param cachedAssociation: lists of Foreign Keys (paths) groups param associations: matching Foreign Keys (paths) groups return Foreign Keys: matching the longest common path that is possible to traverse
type PostDeleter ¶
type PostInserter ¶
type PostInserter interface {
PostInsert(store IDb)
}
type PostRetriever ¶ added in v1.3.0
type PostRetriever interface {
PostRetrieve(store IDb)
}
type PostUpdater ¶
type PostUpdater interface {
PostUpdate(store IDb)
}
type PreDeleter ¶
type PreInserter ¶
type PreUpdater ¶
type Query ¶
func NewQueryQuery ¶
func NewQueryQueryAs ¶
func (*Query) ColumnsReset ¶
func (q *Query) ColumnsReset()
func (*Query) Fetch ¶
This will trigger a result that can be dumped in a tree object using current association path to build the tree result.
It will includes all the columns of all the tables referred by the association path, except where columns were explicitly included.
func (*Query) GetGroupBy ¶
func (*Query) GetGroupByTokens ¶
func (*Query) GetSubQuery ¶
func (*Query) GetSubQueryAlias ¶
func (*Query) GroupByPos ¶
func (*Query) Having ¶
Adds a Having clause to the query. The tokens are not processed. You will have to explicitly set all table alias.
func (*Query) Inner ¶
func (q *Query) Inner(associations ...*Association) *Query
includes the associations as inner joins to the current path
param: associations return this query
func (*Query) IsDistinct ¶
func (*Query) List ¶
List executes a query, putting the result in a slice, passed as an argument or delegating the responsibility of building the result to a processor function.
The argument must be a function func(<<*>struct>) or a slice like *[]<*>struct.
example of function:
books := []Book q := // query q.List(func(b *Book) { books = append(books, b) })
This method does not create a tree of related instances.
func (*Query) ListFlatTree ¶
ListFlatTree executes a query, putting the result in a slice, passed as an argument or delegating the responsibility of building the result to a processor function.
The argument must be a function func(<<*>struct>) or a slice like *[]<*>struct.
See List for non tree query
func (*Query) ListFlatTreeOf ¶
func (q *Query) ListFlatTreeOf(template interface{}) (coll.Collection, error)
Executes a query and transform the results into a flat tree with the passed struct type as the head. It matches the alias with struct property name, building a struct tree. There is no reuse of previous converted entites.
Receives a template instance and returns a collection of structs.
func (*Query) ListInto ¶
List using the closure arguments.
A function is used to build the result list.
The types for scanning are supplied by the function arguments. Arguments can be pointers or not.
Reflection is used to determine the arguments types.
The argument can also be a function with the signature func(*struct).
The results will not be assembled in as a tree.
ex:
roles = make([]string, 0) var role string q.ListInto(func(role *string) { roles = append(roles, *role) })
func (*Query) ListOf ¶
func (q *Query) ListOf(template interface{}) (coll.Collection, error)
Executes a query and transform the results to the struct type passed as parameter, matching the alias with struct property name. If no alias is supplied, it is used the default column alias.
Accepts as parameter the struct type and returns a collection of structs (needs cast)
func (*Query) ListSimple ¶
List simple variables. A closure is used to build the result list. The types for scanning are supplied by the instances parameter. No reflection is used.
ex:
roles = make([]string, 0) var role string q.ListSimple(func() { roles = append(roles, role) }, &role)
func (*Query) ListTreeOf ¶
Executes a query and transform the results into a tree with the passed struct type as the head. It matches the alias with struct property name, building a struct tree. If the transformed data matches a previous converted entity the previous one is reused.
Receives a template instance and returns a collection of structs.
func (*Query) OrderAs ¶
func (q *Query) OrderAs(columnHolder *ColumnHolder) *Query
Order by a column for a specific table alias.
use: query.OrderAs(Column.For("x"))
func (*Query) OrderBy ¶
Defines the column to order by. The column belongs to the table targeted by the last defined association. If there is no last association, the column belongs to the driving table
func (*Query) OrderOn ¶
func (q *Query) OrderOn(column *Column, associations ...*Association) *Query
Order by a column belonging to the table targeted by the supplyied association list.
func (*Query) Outer ¶
func (q *Query) Outer(associations ...*Association) *Query
includes the associations as outer joins to the current path
param associations return
func (*Query) SelectFlatTree ¶
Executes the query and builds a flat struct tree putting the first element in the supplied struct pointer. Since the struct instances are not going to be reused it is not mandatory that the structs implement the toolkit.Hasher interface. Returns true if a result was found, false if no result. See also SelectTree.
func (*Query) SelectInto ¶
the result of the query is put in the passed interface array. returns true if a result was found, false if no result
func (*Query) SelectTo ¶
The first result of the query is put in the passed struct. Returns true if a result was found, false if no result
func (*Query) SelectTree ¶
Executes the query and builds a struct tree, reusing previously obtained entities, putting the first element in the supplied struct pointer. Since the struct instances are going to be reused it is mandatory that all the structs participating in the result tree implement the toolkit.Hasher interface. Returns true if a result was found, false if no result. See also SelectFlatTree.
type RawSql ¶
type RawSql struct { // original sql OriSql string // the converted SQL with the Database specific placeholders Sql string // the parameters values Names []string }
func ToRawSql ¶
func ToRawSql(sql string, translator Translator) *RawSql
converts SQL with named parameters to the specialized Database placeholders
param sql
The SQL to be converted
param params
The named parameters and it's values
@return The {@link RawSql} with the result
func (*RawSql) BuildValues ¶
Convert a Map of named parameter values to a corresponding array.
return the array of values
type Relashionships ¶
type Relashionships struct {
// contains filtered or unexported fields
}
func (Relashionships) As ¶
func (r Relashionships) As(alias string) *Association
func (Relashionships) Fault ¶ added in v1.4.0
func (r Relashionships) Fault() error
type SearchedCase ¶
type SearchedCase struct {
// contains filtered or unexported fields
}
func NewSearchedCase ¶
func NewSearchedCase() *SearchedCase
func (*SearchedCase) Else ¶
func (s *SearchedCase) Else(value interface{}) *SearchedCase
func (*SearchedCase) End ¶
func (s *SearchedCase) End() *Token
func (*SearchedCase) If ¶
func (s *SearchedCase) If(criteria *Criteria) *SearchedWhen
type SearchedWhen ¶
type SearchedWhen struct {
// contains filtered or unexported fields
}
func If ¶
func If(criteria *Criteria) *SearchedWhen
func (*SearchedWhen) Then ¶
func (s *SearchedWhen) Then(value interface{}) *SearchedCase
type SimpleCase ¶
type SimpleCase struct {
// contains filtered or unexported fields
}
func Case ¶
func Case(expression interface{}) *SimpleCase
func NewSimpleCase ¶
func NewSimpleCase(expression interface{}) *SimpleCase
func (*SimpleCase) Else ¶
func (s *SimpleCase) Else(value interface{}) *SimpleCase
func (*SimpleCase) End ¶
func (s *SimpleCase) End() *Token
func (*SimpleCase) When ¶
func (s *SimpleCase) When(expression interface{}) *SimpleWhen
type SimpleWhen ¶
type SimpleWhen struct {
// contains filtered or unexported fields
}
func (*SimpleWhen) Then ¶
func (s *SimpleWhen) Then(value interface{}) *SimpleCase
type StructProperty ¶ added in v1.4.2
type Table ¶
type Table struct { Alias string // table alias PreInsertTrigger func(*Insert) PreUpdateTrigger func(*Update) PreDeleteTrigger func(*Delete) // contains filtered or unexported fields }
func (*Table) ASSOCIATION ¶
func (t *Table) ASSOCIATION(from *Column, to *Column) *Association
func (*Table) AddAssociation ¶
func (t *Table) AddAssociation(fk *Association) *Association
func (*Table) AddAssociationAs ¶
func (t *Table) AddAssociationAs(name string, fk *Association) *Association
func (*Table) GetAssociations ¶
func (t *Table) GetAssociations() []*Association
func (*Table) GetBasicColumns ¶
func (t *Table) GetBasicColumns() coll.Collection
func (*Table) GetCriterias ¶
func (*Table) GetDeletionColumn ¶
func (*Table) GetDiscriminators ¶
func (t *Table) GetDiscriminators() []Discriminator
func (*Table) GetKeyColumns ¶
func (t *Table) GetKeyColumns() coll.Collection
func (*Table) GetSingleKeyColumn ¶
func (*Table) GetVersionColumn ¶
type TableNamer ¶ added in v1.3.0
type TableNamer interface {
TableName() string
}
type Token ¶
type Token struct { Operator string Members []Tokener Value interface{} Alias string // contains filtered or unexported fields }
func Add ¶
func Add(values ...interface{}) *Token
the args can be Columns, Tokens, nil or primitives
func Minus ¶
func Minus(values ...interface{}) *Token
the args can be Columns, Tokens, nil or primitives
func Multiply ¶
func Multiply(values ...interface{}) *Token
the args can be Columns, Tokens, nil or primitives
func NewEndToken ¶
func (*Token) GetMembers ¶
func (*Token) GetOperator ¶
func (*Token) GetPseudoTableAlias ¶
func (*Token) GetTableAlias ¶
func (*Token) GreaterOrMatch ¶
func (*Token) LesserOrMatch ¶
func (*Token) SetMembers ¶
func (*Token) SetOperator ¶
func (*Token) SetPseudoTableAlias ¶
func (*Token) SetTableAlias ¶
Propagates table alias
type Tokener ¶
type Tokener interface { tk.Clonable GetAlias() string SetAlias(alias string) SetTableAlias(tableAlias string) GetTableAlias() string SetPseudoTableAlias(tableAlias string) GetPseudoTableAlias() string IsNil() bool GetMembers() []Tokener SetMembers(members ...Tokener) SetValue(value interface{}) GetValue() interface{} GetOperator() string SetOperator(operator string) }
type TransactionManager ¶
type TransactionManager struct {
// contains filtered or unexported fields
}
func NewTransactionManager ¶
func NewTransactionManager(database *sql.DB, translator Translator, options ...func(*TransactionManager)) *TransactionManager
NewTransactionManager creates a new Transaction Manager
func (*TransactionManager) Mappings ¶ added in v1.5.0
func (t *TransactionManager) Mappings(typ reflect.Type) (map[string]*StructProperty, error)
func (*TransactionManager) NoTransaction ¶
func (t *TransactionManager) NoTransaction(handler func(db IDb) error) error
func (*TransactionManager) RegisterType ¶ added in v1.5.0
func (d *TransactionManager) RegisterType(v interface{}) error
func (*TransactionManager) Store ¶
func (t *TransactionManager) Store() IDb
func (*TransactionManager) Transaction ¶
func (t *TransactionManager) Transaction(handler func(db IDb) error) error
func (*TransactionManager) With ¶
func (t *TransactionManager) With(db IDb) ITransactionManager
type Translator ¶
type Translator interface { GetPlaceholder(index int, name string) string // INSERT GetAutoKeyStrategy() AutoKeyStrategy GetSqlForInsert(insert *Insert) string // QUERY GetSqlForQuery(query *Query) string // UPDATE GetSqlForUpdate(update *Update) string // DELTE GetSqlForDelete(del *Delete) string // GetSqlForSequence(sequence *Sequence, nextValue bool) string GetAutoNumberQuery(column *Column) string // GetMaxTableChars() int PaginateSQL(query *Query, sql string) string Translate(dmlType DmlType, token Tokener) (string, error) TableName(table *Table) string ColumnName(column *Column) string ColumnAlias(token Tokener, position int) string IgnoreNullKeys() bool RegisterConverter(name string, c Converter) GetConverter(name string) Converter }
Source Files ¶
- alias_bag.go
- association.go
- case.go
- column.go
- column_holder.go
- crawler.go
- crawler_node.go
- criteria.go
- db.go
- delete.go
- discriminator.go
- dml_base.go
- dml_core.go
- e_token.go
- entity_map.go
- entity_property.go
- entity_transformer.go
- entity_tree_transformer.go
- insert.go
- join.go
- named_parameter_utils.go
- order.go
- parsed_sql.go
- query.go
- relation.go
- table.go
- token.go
- token_factory.go
- transaction_manager.go
- translator.go
- union.go
- update.go