Documentation ¶
Index ¶
- Constants
- Variables
- func CollectionHandlerAssignToAllDb(ctx *CollectionContext) error
- func CollectionHandlerCreateTable(ctx *CollectionContext) error
- func CollectionHandlerDropTable(ctx *CollectionContext) (err error)
- func CollectionHandlerDropTablePreload(option string) func(ctx *CollectionContext) error
- func CollectionHandlerExistTableAbort(ctx *CollectionContext) error
- func CollectionHandlerFind(ctx *CollectionContext) error
- func CollectionHandlerFindOne(ctx *CollectionContext) error
- func CollectionHandlerFindOneAssignDbIndex(ctx *CollectionContext) error
- func CollectionHandlerInsert(ctx *CollectionContext) error
- func CollectionHandlerInsertAssignDbIndex(ctx *CollectionContext) error
- func CollectionHandlerInsertTimeGenerate(ctx *CollectionContext) error
- func CollectionHandlerNotExistTableAbort(ctx *CollectionContext) error
- func CollectionHandlerPreloadContainerCheck(ctx *CollectionContext) error
- func CollectionHandlerPreloadFind(ctx *CollectionContext) error
- func CollectionHandlerPreloadInsertOrSave(option string) func(*CollectionContext) error
- func CollectionHandlerSave(ctx *CollectionContext) error
- func CollectionHandlerSaveTimeGenerate(ctx *CollectionContext) error
- func CollectionHandlerSimplePreload(option string) func(ctx *CollectionContext) error
- func CollectionHandlerSoftDeleteCheck(ctx *CollectionContext) error
- func CollectionHandlerUSave(ctx *CollectionContext) error
- func CollectionHandlerUpdate(ctx *CollectionContext) error
- func CollectionHandlerUpdateTimeGenerate(ctx *CollectionContext) error
- func DefaultCollectionTemplateExec(brick *CollectionBrick) map[string]BasicExec
- func DefaultTemplateExec(brick *ToyBrick) map[string]BasicExec
- func GetBelongsIDFieldName(subModel *Model, containerField Field) string
- func GetRelationFieldName(subModel *Model) string
- func GetStructFields(_type reflect.Type) []reflect.StructField
- func GetStructValueFields(value reflect.Value) []reflect.Value
- func GetTagKeyVal(tag string) []*tagKeyValue
- func HandlerCasVersionPushOne(ctx *Context) error
- func HandlerCollectionCasVersionPushOne(ctx *CollectionContext) error
- func HandlerCollectionHardDelete(ctx *CollectionContext) error
- func HandlerCollectionPreloadDelete(ctx *CollectionContext) error
- func HandlerCollectionSearchWithPrimaryKey(ctx *CollectionContext) error
- func HandlerCollectionSoftDelete(ctx *CollectionContext) error
- func HandlerCollectionSoftDeleteCheck(ctx *CollectionContext) error
- func HandlerCreateTable(ctx *Context) error
- func HandlerCreateTablePreload(option string) func(ctx *Context) error
- func HandlerDropTable(ctx *Context) (err error)
- func HandlerDropTablePreload(option string) func(ctx *Context) error
- func HandlerExistTableAbort(ctx *Context) error
- func HandlerFind(ctx *Context) error
- func HandlerHardDelete(ctx *Context) error
- func HandlerInsert(ctx *Context) error
- func HandlerInsertTimeGenerate(ctx *Context) error
- func HandlerNotExistTableAbort(ctx *Context) error
- func HandlerPreloadContainerCheck(ctx *Context) error
- func HandlerPreloadDelete(ctx *Context) error
- func HandlerPreloadFind(ctx *Context) error
- func HandlerPreloadInsertOrSave(option string) func(*Context) error
- func HandlerPreloadOnJoinFind(ctx *Context) error
- func HandlerSave(ctx *Context) error
- func HandlerSaveTimeGenerate(ctx *Context) error
- func HandlerSearchWithPrimaryKey(ctx *Context) error
- func HandlerSoftDelete(ctx *Context) error
- func HandlerSoftDeleteCheck(ctx *Context) error
- func HandlerUSave(ctx *Context) error
- func HandlerUSaveTimeGenerate(ctx *Context) error
- func HandlerUpdate(ctx *Context) error
- func HandlerUpdateTimeGenerate(ctx *Context) error
- func IntKind(kind reflect.Kind) bool
- func IsZero(v reflect.Value) bool
- func LoopDivePtr(vValue reflect.Value) reflect.Value
- func LoopDiveSliceAndPtr(vValue reflect.Value) reflect.Value
- func LoopIndirect(vValue reflect.Value) reflect.Value
- func LoopIndirectAndNew(vValue reflect.Value) reflect.Value
- func LoopTypeIndirect(_type reflect.Type) reflect.Type
- func LoopTypeIndirectSliceAndPtr(_type reflect.Type) reflect.Type
- func ModelName(val reflect.Value) string
- func NewField(f *reflect.StructField, fieldVal reflect.Value, table_name string) *modelField
- func SafeAppend(l reflect.Value, x ...reflect.Value) reflect.Value
- func SqlNameConvert(name string) string
- func ToSqlType(_type reflect.Type) (sqlType string)
- type AffectNode
- type AssociationType
- type BasicExec
- type BelongToPreload
- type BrickCommon
- func (t *BrickCommon) CopyBelongToPreload() map[string]*BelongToPreload
- func (t *BrickCommon) CopyManyToManyPreload() map[string]*ManyToManyPreload
- func (t *BrickCommon) CopyOneToManyPreload() map[string]*OneToManyPreload
- func (t *BrickCommon) CopyOneToOnePreload() map[string]*OneToOnePreload
- func (t *BrickCommon) ToDesc(v interface{}) Field
- type CacheMeta
- type CollectionBrick
- func (t *CollectionBrick) And() CollectionBrickAnd
- func (t *CollectionBrick) BindDefaultFields(args ...interface{}) *CollectionBrick
- func (t *CollectionBrick) BindFields(mode Mode, args ...interface{}) *CollectionBrick
- func (t *CollectionBrick) Clone() *CollectionBrick
- func (t *CollectionBrick) ConditionExec() ExecValue
- func (t *CollectionBrick) Conditions(search SearchList) *CollectionBrick
- func (t *CollectionBrick) CopyMapPreloadBrick() map[string]*CollectionBrick
- func (t *CollectionBrick) CopyStatus(statusBrick *CollectionBrick) *CollectionBrick
- func (t *CollectionBrick) Count() (count int, err error)
- func (t *CollectionBrick) CountExec() (exec ExecValue)
- func (t *CollectionBrick) CreateTable() (*Result, error)
- func (t *CollectionBrick) CreateTableIfNotExist() (*Result, error)
- func (t *CollectionBrick) CustomBelongToPreload(container, relationship interface{}, args ...interface{}) *CollectionBrick
- func (t *CollectionBrick) CustomManyToManyPreload(middleStruct, container, relation, subRelation interface{}, ...) *CollectionBrick
- func (t *CollectionBrick) CustomOneToManyPreload(container, relationship interface{}, args ...interface{}) *CollectionBrick
- func (t *CollectionBrick) CustomOneToOnePreload(container, relationship interface{}, args ...interface{}) *CollectionBrick
- func (t *CollectionBrick) DBIndex(i int) *CollectionBrick
- func (t *CollectionBrick) Debug() *CollectionBrick
- func (t *CollectionBrick) Delete(v interface{}) (*Result, error)
- func (t *CollectionBrick) DeleteExec() ExecValue
- func (t *CollectionBrick) DeleteWithConditions() (*Result, error)
- func (t *CollectionBrick) DropTable() (*Result, error)
- func (t *CollectionBrick) DropTableIfExist() (*Result, error)
- func (t *CollectionBrick) Enter() *CollectionBrick
- func (t *CollectionBrick) Exec(exec ExecValue, i int) (sql.Result, error)
- func (t *CollectionBrick) Find(v interface{}) (*Result, error)
- func (t *CollectionBrick) FindExec(records ModelRecordFieldTypes) ExecValue
- func (t *CollectionBrick) GetContext(option string, records ModelRecords) *CollectionContext
- func (t *CollectionBrick) HasTable() ([]bool, error)
- func (t *CollectionBrick) IgnoreMode(s Mode, ignore IgnoreMode) *CollectionBrick
- func (t *CollectionBrick) Insert(v interface{}) (*Result, error)
- func (t *CollectionBrick) InsertExec(record ModelRecord) ExecValue
- func (t *CollectionBrick) Or() CollectionBrickOr
- func (t *CollectionBrick) Preload(fv interface{}) *CollectionBrick
- func (t *CollectionBrick) Query(exec ExecValue, i int) (*sql.Rows, error)
- func (t *CollectionBrick) QueryRow(exec ExecValue, i int) *sql.Row
- func (t *CollectionBrick) RightValuePreload(fv interface{}) *CollectionBrick
- func (t *CollectionBrick) Save(v interface{}) (*Result, error)
- func (t *CollectionBrick) SaveExec(record ModelRecord) ExecValue
- func (t *CollectionBrick) Scope(fn func(*CollectionBrick) *CollectionBrick) *CollectionBrick
- func (t *CollectionBrick) Selector(selector DBPrimarySelector) *CollectionBrick
- func (t *CollectionBrick) Template(temp string, args ...interface{}) *CollectionBrick
- func (t *CollectionBrick) USave(v interface{}) (*Result, error)
- func (t *CollectionBrick) Update(v interface{}) (*Result, error)
- func (t *CollectionBrick) UpdateExec(record ModelRecord) ExecValue
- func (t *CollectionBrick) Where(expr SearchExpr, key FieldSelection, v ...interface{}) *CollectionBrick
- func (t *CollectionBrick) WhereGroup(expr SearchExpr, group interface{}) *CollectionBrick
- type CollectionBrickAnd
- type CollectionBrickOr
- type CollectionContext
- type CollectionExecAction
- type CollectionHandlerFunc
- type CollectionHandlersChain
- type CollectionQueryAction
- type Column
- type ColumnName
- type ColumnNameValue
- type ColumnValue
- type Context
- type DBPrimarySelector
- type DBValSelector
- type DefaultDialect
- func (dia DefaultDialect) AddForeignKey(model, relationModel *Model, ForeignKeyField Field) ExecValue
- func (dia DefaultDialect) ConditionExec(search SearchList, limit, offset int, orderBy []Column, groupBy []Column) ExecValue
- func (dia DefaultDialect) CountExec(model *Model, alias string) ExecValue
- func (dia DefaultDialect) CreateTable(model *Model, foreign map[string]ForeignKey) (execlist []ExecValue)
- func (dia DefaultDialect) DeleteExec(model *Model) (exec ExecValue)
- func (dia DefaultDialect) DropForeignKey(model *Model, ForeignKeyField Field) ExecValue
- func (dia DefaultDialect) DropTable(m *Model) ExecValue
- func (dia DefaultDialect) FindExec(model *Model, columns []Column, alias string) ExecValue
- func (dia DefaultDialect) HasTable(model *Model) ExecValue
- func (dia DefaultDialect) InsertExec(model *Model, columnValues []ColumnNameValue) ExecValue
- func (dia DefaultDialect) InsertExecutor(db Executor, exec ExecValue, debugPrinter func(ExecValue, error)) (sql.Result, error)
- func (dia DefaultDialect) JoinExec(mainSwap *JoinSwap) ExecValue
- func (dia DefaultDialect) SaveExec(model *Model, columnValues []ColumnNameValue) ExecValue
- func (dia DefaultDialect) SaveExecutor(db Executor, exec ExecValue, debugPrinter func(ExecValue, error)) (sql.Result, error)
- func (dia DefaultDialect) SearchExec(s SearchList) ExecValue
- func (dia DefaultDialect) TemplateExec(tExec BasicExec, execs map[string]BasicExec) (ExecValue, error)
- func (dia DefaultDialect) UpdateExec(model *Model, columnValues []ColumnValue) ExecValue
- type DefaultExec
- type Dialect
- type ErrCannotSet
- type ErrCollectionClose
- type ErrCollectionDBSelectorNotFound
- type ErrCollectionExec
- type ErrCollectionQuery
- type ErrCollectionQueryRow
- type ErrDbIndexNotSet
- type ErrInvalidModelName
- type ErrInvalidModelType
- type ErrInvalidPreloadField
- type ErrInvalidRecordType
- type ErrLastInsertId
- type ErrModelDuplicateAssociation
- type ErrNilPrimaryKey
- type ErrNotSupportRowsAffected
- type ErrRepeatField
- type ErrSameColumnName
- type ErrSaveFailure
- type ErrTemplateExecInvalidWord
- type ErrZeroPrimaryKey
- type ExecAction
- type ExecValue
- type Executor
- type Field
- type FieldList
- type FieldSelection
- type FieldValue
- type FieldValueList
- type ForeignKey
- type HandlerFunc
- type HandlersChain
- type IgnoreMode
- type Join
- type JoinSwap
- type ManyToManyPreload
- type Mode
- type Model
- func (m *Model) GetFieldWithName(name string) Field
- func (m *Model) GetIndexMap() map[string][]Field
- func (m *Model) GetNameFieldMap() map[string]Field
- func (m *Model) GetOffsetField(offset uintptr) Field
- func (m *Model) GetOffsetFieldMap() map[uintptr]Field
- func (m *Model) GetOnePrimary() Field
- func (m *Model) GetPosField(pos int) Field
- func (m *Model) GetPosFields(pos []int) []Field
- func (m *Model) GetPrimary() []Field
- func (m *Model) GetSqlFields() []Field
- func (m *Model) GetUniqueIndexMap() map[string][]Field
- type ModelDefault
- type ModelGroupBy
- type ModelIndexRecord
- type ModelNameMapRecord
- func (m *ModelNameMapRecord) AllField() map[string]reflect.Value
- func (m *ModelNameMapRecord) DeleteField(name string)
- func (m *ModelNameMapRecord) Field(name string) reflect.Value
- func (m *ModelNameMapRecord) FieldAddress(name string) reflect.Value
- func (m *ModelNameMapRecord) GetFieldType(name string) reflect.Type
- func (m *ModelNameMapRecord) IsVariableContainer() bool
- func (m *ModelNameMapRecord) SetField(name string, value reflect.Value)
- func (m *ModelNameMapRecord) Source() reflect.Value
- type ModelNameMapRecords
- func (m *ModelNameMapRecords) Add(v reflect.Value) ModelRecord
- func (m *ModelNameMapRecords) ElemType() reflect.Type
- func (m *ModelNameMapRecords) GetFieldAddressType(name string) reflect.Type
- func (m *ModelNameMapRecords) GetFieldType(name string) reflect.Type
- func (m *ModelNameMapRecords) GetRecord(i int) ModelRecord
- func (m *ModelNameMapRecords) GetRecords() []ModelRecord
- func (m *ModelNameMapRecords) GroupBy(key string) ModelGroupBy
- func (m *ModelNameMapRecords) GroupByFunc(key string, fn func(int, ModelRecord))
- func (m *ModelNameMapRecords) IsVariableContainer() bool
- func (m *ModelNameMapRecords) Len() int
- func (m *ModelNameMapRecords) Source() reflect.Value
- type ModelOffsetMapRecord
- func (m *ModelOffsetMapRecord) AllField() map[string]reflect.Value
- func (m *ModelOffsetMapRecord) DeleteField(name string)
- func (m *ModelOffsetMapRecord) Field(name string) reflect.Value
- func (m *ModelOffsetMapRecord) FieldAddress(name string) reflect.Value
- func (m *ModelOffsetMapRecord) GetFieldType(name string) reflect.Type
- func (m *ModelOffsetMapRecord) IsVariableContainer() bool
- func (m *ModelOffsetMapRecord) SetField(name string, value reflect.Value)
- func (m *ModelOffsetMapRecord) Source() reflect.Value
- type ModelOffsetMapRecords
- func (m *ModelOffsetMapRecords) Add(v reflect.Value) ModelRecord
- func (m *ModelOffsetMapRecords) ElemType() reflect.Type
- func (m *ModelOffsetMapRecords) GetFieldAddressType(name string) reflect.Type
- func (m *ModelOffsetMapRecords) GetFieldType(name string) reflect.Type
- func (m *ModelOffsetMapRecords) GetRecord(i int) ModelRecord
- func (m *ModelOffsetMapRecords) GetRecords() []ModelRecord
- func (m *ModelOffsetMapRecords) GroupBy(key string) ModelGroupBy
- func (m *ModelOffsetMapRecords) IsVariableContainer() bool
- func (m *ModelOffsetMapRecords) Len() int
- func (m *ModelOffsetMapRecords) Source() reflect.Value
- type ModelRecord
- type ModelRecordFieldTypes
- type ModelRecords
- type ModelStructRecord
- func (m *ModelStructRecord) AllField() map[string]reflect.Value
- func (m *ModelStructRecord) DeleteField(name string)
- func (m *ModelStructRecord) Field(name string) reflect.Value
- func (m *ModelStructRecord) FieldAddress(name string) reflect.Value
- func (m *ModelStructRecord) GetFieldType(name string) reflect.Type
- func (m *ModelStructRecord) IsVariableContainer() bool
- func (m *ModelStructRecord) SetField(name string, value reflect.Value)
- func (m *ModelStructRecord) Source() reflect.Value
- type ModelStructRecords
- func (m *ModelStructRecords) Add(v reflect.Value) ModelRecord
- func (m *ModelStructRecords) ElemType() reflect.Type
- func (m *ModelStructRecords) GetFieldAddressType(field string) reflect.Type
- func (m *ModelStructRecords) GetFieldType(field string) reflect.Type
- func (m *ModelStructRecords) GetRecord(i int) ModelRecord
- func (m *ModelStructRecords) GetRecords() []ModelRecord
- func (m *ModelStructRecords) GroupBy(key string) ModelGroupBy
- func (m *ModelStructRecords) IsVariableContainer() bool
- func (m *ModelStructRecords) Len() int
- func (m *ModelStructRecords) Source() reflect.Value
- type MySqlDialect
- func (dia MySqlDialect) CreateTable(model *Model, foreign map[string]ForeignKey) (execlist []ExecValue)
- func (dia MySqlDialect) HasTable(model *Model) ExecValue
- func (dia MySqlDialect) SaveExec(model *Model, columnValues []ColumnNameValue) ExecValue
- func (dia MySqlDialect) SaveExecutor(db Executor, exec ExecValue, debugPrinter func(ExecValue, error)) (sql.Result, error)
- type OneToManyPreload
- type OneToOnePreload
- type Pair
- type PostgreSqlDialect
- func (dia PostgreSqlDialect) AddForeignKey(model, relationModel *Model, ForeignKeyField Field) ExecValue
- func (dia PostgreSqlDialect) ConditionExec(search SearchList, limit, offset int, orderBy []Column, groupBy []Column) ExecValue
- func (dia PostgreSqlDialect) CountExec(model *Model, alias string) ExecValue
- func (dia PostgreSqlDialect) CreateTable(model *Model, foreign map[string]ForeignKey) (execlist []ExecValue)
- func (dia PostgreSqlDialect) DeleteExec(model *Model) (exec ExecValue)
- func (dia PostgreSqlDialect) DropForeignKey(model *Model, ForeignKeyField Field) ExecValue
- func (dia PostgreSqlDialect) DropTable(m *Model) ExecValue
- func (dia PostgreSqlDialect) FindExec(model *Model, columns []Column, alias string) ExecValue
- func (dia PostgreSqlDialect) HasTable(model *Model) ExecValue
- func (dia PostgreSqlDialect) InsertExec(model *Model, columnValues []ColumnNameValue) ExecValue
- func (dia PostgreSqlDialect) InsertExecutor(db Executor, exec ExecValue, debugPrinter func(ExecValue, error)) (sql.Result, error)
- func (dia PostgreSqlDialect) JoinExec(mainSwap *JoinSwap) ExecValue
- func (dia PostgreSqlDialect) SaveExec(model *Model, columnNameValues []ColumnNameValue) ExecValue
- func (dia PostgreSqlDialect) SearchExec(s SearchList) ExecValue
- func (dia PostgreSqlDialect) TemplateExec(tExec BasicExec, execs map[string]BasicExec) (ExecValue, error)
- func (dia PostgreSqlDialect) UpdateExec(model *Model, columnValues []ColumnValue) ExecValue
- type PreCollectionBrick
- type PreJoinSwap
- type PreToyBrick
- type QToSExec
- type QueryAction
- type RawResult
- type ReportData
- type Result
- type SearchCell
- type SearchExpr
- type SearchList
- type SearchTree
- type SqlAction
- type Sqlite3Dialect
- type Toy
- func (t *Toy) BelongToBind(model, subModel *Model, containerField, relationField Field) *BelongToPreload
- func (t *Toy) BelongToPreload(model *Model, field Field) *BelongToPreload
- func (t *Toy) Close() error
- func (t *Toy) DB() *sql.DB
- func (t *Toy) Join(model *Model, field Field) *Join
- func (t *Toy) ManyToManyPreload(model *Model, field Field, isRight bool) *ManyToManyPreload
- func (t *Toy) ManyToManyPreloadBind(model, subModel, middleModel *Model, ...) *ManyToManyPreload
- func (t *Toy) MiddleModel(v, sv interface{}) *ToyBrick
- func (t *Toy) Model(v interface{}) *ToyBrick
- func (t *Toy) ModelHandlers(option string, model *Model) HandlersChain
- func (t *Toy) OneToManyBind(model, subModel *Model, containerField, relationField Field) *OneToManyPreload
- func (t *Toy) OneToManyPreload(model *Model, field Field) *OneToManyPreload
- func (t *Toy) OneToOneBind(model, subModel *Model, containerField, relationField Field) *OneToOnePreload
- func (t *Toy) OneToOnePreload(model *Model, field Field) *OneToOnePreload
- type ToyBrick
- func (t *ToyBrick) Alias(alias string) *ToyBrick
- func (t *ToyBrick) And() ToyBrickAnd
- func (t *ToyBrick) Begin() *ToyBrick
- func (t *ToyBrick) BindDefaultFields(args ...FieldSelection) *ToyBrick
- func (t *ToyBrick) BindFields(mode Mode, args ...interface{}) *ToyBrick
- func (t *ToyBrick) CleanOwnGroupBy() *ToyBrick
- func (t *ToyBrick) CleanOwnOrderBy() *ToyBrick
- func (t *ToyBrick) CleanOwnSearch() *ToyBrick
- func (t *ToyBrick) Commit() error
- func (t *ToyBrick) ConditionExec() ExecValue
- func (t *ToyBrick) Conditions(search SearchList) *ToyBrick
- func (t *ToyBrick) CopyJoin() map[string]*Join
- func (t *ToyBrick) CopyJoinSwap() map[string]*JoinSwap
- func (t *ToyBrick) CopyMapPreloadBrick() map[string]*ToyBrick
- func (t *ToyBrick) CopyStatus(statusBrick *ToyBrick) *ToyBrick
- func (t *ToyBrick) Count() (count int, err error)
- func (t *ToyBrick) CountExec() (exec ExecValue)
- func (t *ToyBrick) CreateTable() (*Result, error)
- func (t *ToyBrick) CreateTableIfNotExist() (*Result, error)
- func (t *ToyBrick) CustomBelongToPreload(container, relationship FieldSelection, args ...interface{}) *ToyBrick
- func (t *ToyBrick) CustomManyToManyPreload(middleStruct interface{}, container FieldSelection, ...) *ToyBrick
- func (t *ToyBrick) CustomOneToManyPreload(container FieldSelection, relationship interface{}, args ...interface{}) *ToyBrick
- func (t *ToyBrick) CustomOneToOnePreload(container FieldSelection, relationship interface{}, args ...interface{}) *ToyBrick
- func (t *ToyBrick) Debug() *ToyBrick
- func (t *ToyBrick) Delete(v interface{}) (*Result, error)
- func (t *ToyBrick) DeleteExec() ExecValue
- func (t *ToyBrick) DeleteWithConditions() (*Result, error)
- func (t *ToyBrick) DropTable() (*Result, error)
- func (t *ToyBrick) DropTableIfExist() (*Result, error)
- func (t *ToyBrick) Enter() *ToyBrick
- func (t *ToyBrick) Exec(exec ExecValue) (result sql.Result, err error)
- func (t *ToyBrick) Find(v interface{}) (*Result, error)
- func (t *ToyBrick) FindExec(columns []Column) ExecValue
- func (t *ToyBrick) GetContext(option string, records ModelRecords) *Context
- func (t *ToyBrick) GroupBy(vList ...FieldSelection) *ToyBrick
- func (t *ToyBrick) HasTable() (b bool, err error)
- func (t *ToyBrick) IgnoreMode(s Mode, ignore IgnoreMode) *ToyBrick
- func (t *ToyBrick) Insert(v interface{}) (*Result, error)
- func (t *ToyBrick) InsertExec(record ModelRecord) ExecValue
- func (t *ToyBrick) Join(fv FieldSelection) *ToyBrick
- func (t *ToyBrick) Limit(i int) *ToyBrick
- func (t *ToyBrick) Offset(i int) *ToyBrick
- func (t *ToyBrick) Or() ToyBrickOr
- func (t *ToyBrick) OrderBy(vList ...FieldSelection) *ToyBrick
- func (t *ToyBrick) Preload(fv FieldSelection) *ToyBrick
- func (t *ToyBrick) Prepare(query string) (*sql.Stmt, error)
- func (t *ToyBrick) Query(exec ExecValue) (rows *sql.Rows, err error)
- func (t *ToyBrick) QueryRow(exec ExecValue) (row *sql.Row)
- func (t *ToyBrick) RightValuePreload(fv FieldSelection) *ToyBrick
- func (t *ToyBrick) Rollback() error
- func (t *ToyBrick) Save(v interface{}) (*Result, error)
- func (t *ToyBrick) SaveExec(record ModelRecord) ExecValue
- func (t *ToyBrick) Scope(fn func(*ToyBrick) *ToyBrick) *ToyBrick
- func (t *ToyBrick) Swap() *ToyBrick
- func (t *ToyBrick) Template(temp string, args ...interface{}) *ToyBrick
- func (t *ToyBrick) USave(v interface{}) (*Result, error)
- func (t *ToyBrick) Update(v interface{}) (*Result, error)
- func (t *ToyBrick) UpdateExec(record ModelRecord) ExecValue
- func (t *ToyBrick) Where(expr SearchExpr, key FieldSelection, v ...interface{}) *ToyBrick
- func (t *ToyBrick) WhereGroup(expr SearchExpr, group interface{}) *ToyBrick
- type ToyBrickAnd
- type ToyBrickOr
- type ToyCollection
- func (t *ToyCollection) BelongToBind(model, subModel *Model, containerField, relationField Field) *BelongToPreload
- func (t *ToyCollection) BelongToPreload(model *Model, field Field) *BelongToPreload
- func (t *ToyCollection) Close() error
- func (t *ToyCollection) ManyToManyPreload(model *Model, field Field, isRight bool) *ManyToManyPreload
- func (t *ToyCollection) ManyToManyPreloadBind(model, subModel, middleModel *Model, ...) *ManyToManyPreload
- func (t *ToyCollection) MiddleModel(v, sv interface{}) *CollectionBrick
- func (t *ToyCollection) Model(v interface{}) *CollectionBrick
- func (t *ToyCollection) ModelHandlers(option string, model *Model) CollectionHandlersChain
- func (t *ToyCollection) OneToManyBind(model, subModel *Model, containerField, relationField Field) *OneToManyPreload
- func (t *ToyCollection) OneToManyPreload(model *Model, field Field) *OneToManyPreload
- func (t *ToyCollection) OneToOneBind(model, subModel *Model, containerField, relationField Field) *OneToOnePreload
- func (t *ToyCollection) OneToOnePreload(model *Model, field Field) *OneToOnePreload
- func (t *ToyCollection) SetModelHandlers(option string, model *Model, handlers CollectionHandlersChain)
- type ToyKernel
Constants ¶
const ( IgnoreNo = IgnoreMode(0) IgnoreFalse = IgnoreMode(1 << iota) IgnoreZeroInt IgnoreZeroFloat IgnoreZeroComplex IgnoreNilString IgnoreNilPoint IgnoreZeroLen IgnoreNullStruct IgnoreNil = IgnoreNilPoint | IgnoreZeroLen IgnoreZero = IgnoreFalse | IgnoreZeroInt | IgnoreZeroFloat | IgnoreZeroComplex | IgnoreNilString | IgnoreNilPoint | IgnoreZeroLen | IgnoreNullStruct )
const ( ExprIgnore = "" ExprAnd = "AND" ExprOr = "OR" ExprNot = "NOT" ExprEqual = "=" ExprNotEqual = "<>" ExprGreater = ">" ExprGreaterEqual = ">=" ExprLess = "<" ExprLessEqual = "<=" ExprBetween = "BETWEEN" ExprNotBetween = "NOT BETWEEN" ExprIn = "IN" ExprNotIn = "NOT IN" ExprLike = "LIKE" ExprNotLike = "NOT LIKE" ExprNull = "NULL" ExprNotNull = "NOT NULL" )
Variables ¶
Functions ¶
func CollectionHandlerAssignToAllDb ¶
func CollectionHandlerAssignToAllDb(ctx *CollectionContext) error
assign after handlers to all db
func CollectionHandlerCreateTable ¶
func CollectionHandlerCreateTable(ctx *CollectionContext) error
func CollectionHandlerDropTable ¶
func CollectionHandlerDropTable(ctx *CollectionContext) (err error)
func CollectionHandlerDropTablePreload ¶
func CollectionHandlerDropTablePreload(option string) func(ctx *CollectionContext) error
preload schedule oneToOne -> oneToMany -> current model -> manyToMany(sub -> middle) -> Next() -> belongTo
func CollectionHandlerExistTableAbort ¶
func CollectionHandlerExistTableAbort(ctx *CollectionContext) error
func CollectionHandlerFind ¶
func CollectionHandlerFind(ctx *CollectionContext) error
func CollectionHandlerFindOne ¶
func CollectionHandlerFindOne(ctx *CollectionContext) error
func CollectionHandlerFindOneAssignDbIndex ¶
func CollectionHandlerFindOneAssignDbIndex(ctx *CollectionContext) error
func CollectionHandlerInsert ¶
func CollectionHandlerInsert(ctx *CollectionContext) error
func CollectionHandlerInsertAssignDbIndex ¶
func CollectionHandlerInsertAssignDbIndex(ctx *CollectionContext) error
func CollectionHandlerInsertTimeGenerate ¶
func CollectionHandlerInsertTimeGenerate(ctx *CollectionContext) error
func CollectionHandlerNotExistTableAbort ¶
func CollectionHandlerNotExistTableAbort(ctx *CollectionContext) error
func CollectionHandlerPreloadContainerCheck ¶
func CollectionHandlerPreloadContainerCheck(ctx *CollectionContext) error
func CollectionHandlerPreloadFind ¶
func CollectionHandlerPreloadFind(ctx *CollectionContext) error
func CollectionHandlerPreloadInsertOrSave ¶
func CollectionHandlerPreloadInsertOrSave(option string) func(*CollectionContext) error
func CollectionHandlerSave ¶
func CollectionHandlerSave(ctx *CollectionContext) error
func CollectionHandlerSaveTimeGenerate ¶
func CollectionHandlerSaveTimeGenerate(ctx *CollectionContext) error
func CollectionHandlerSimplePreload ¶
func CollectionHandlerSimplePreload(option string) func(ctx *CollectionContext) error
preload schedule belongTo -> Next() -> oneToOne -> oneToMany -> manyToMany(sub -> middle)
func CollectionHandlerSoftDeleteCheck ¶
func CollectionHandlerSoftDeleteCheck(ctx *CollectionContext) error
func CollectionHandlerUSave ¶
func CollectionHandlerUSave(ctx *CollectionContext) error
func CollectionHandlerUpdate ¶
func CollectionHandlerUpdate(ctx *CollectionContext) error
func CollectionHandlerUpdateTimeGenerate ¶
func CollectionHandlerUpdateTimeGenerate(ctx *CollectionContext) error
func DefaultCollectionTemplateExec ¶
func DefaultCollectionTemplateExec(brick *CollectionBrick) map[string]BasicExec
func DefaultTemplateExec ¶
func GetBelongsIDFieldName ¶
func GetRelationFieldName ¶
generate a default field name with relation model
func GetStructFields ¶
func GetStructFields(_type reflect.Type) []reflect.StructField
get all StructField with struct field and its embed field
func GetStructValueFields ¶
get all Value with struct field and its embed struct field
func GetTagKeyVal ¶
func GetTagKeyVal(tag string) []*tagKeyValue
func HandlerCollectionCasVersionPushOne ¶
func HandlerCollectionCasVersionPushOne(ctx *CollectionContext) error
func HandlerCollectionHardDelete ¶
func HandlerCollectionHardDelete(ctx *CollectionContext) error
func HandlerCollectionPreloadDelete ¶
func HandlerCollectionPreloadDelete(ctx *CollectionContext) error
func HandlerCollectionSearchWithPrimaryKey ¶
func HandlerCollectionSearchWithPrimaryKey(ctx *CollectionContext) error
func HandlerCollectionSoftDelete ¶
func HandlerCollectionSoftDelete(ctx *CollectionContext) error
func HandlerCollectionSoftDeleteCheck ¶
func HandlerCollectionSoftDeleteCheck(ctx *CollectionContext) error
func HandlerCreateTable ¶
func HandlerCreateTablePreload ¶
preload schedule belongTo -> Next() -> oneToOne -> oneToMany -> manyToMany(sub -> middle)
func HandlerDropTable ¶
func HandlerDropTablePreload ¶
preload schedule oneToOne -> oneToMany -> current model -> manyToMany(sub -> middle) -> Next() -> belongTo
func HandlerExistTableAbort ¶
func HandlerFind ¶
func HandlerHardDelete ¶
func HandlerInsert ¶
func HandlerPreloadDelete ¶
func HandlerPreloadFind ¶
func HandlerSave ¶
if have not primary ,try to insert else try to replace
func HandlerSaveTimeGenerate ¶
func HandlerSoftDelete ¶
func HandlerSoftDeleteCheck ¶
func HandlerUSave ¶
func HandlerUpdate ¶
func LoopDiveSliceAndPtr ¶
loop to get ptr value elem if its type is ptr, get it's elem if it's type is slice get it's first elem or zero value's elem type loop get will not change the source object
func LoopIndirect ¶
loop to get ptr value elem when its type is not ptr
func LoopIndirectAndNew ¶
loop to get ptr value elem when its type is not ptr and if value is zero, set a new one
func LoopTypeIndirect ¶
loop to get ptr type elem when its type is not ptr/slice
func LoopTypeIndirectSliceAndPtr ¶
loop to get ptr/slice type elem when its type is not ptr/slice
func NewField ¶
func NewField(f *reflect.StructField, fieldVal reflect.Value, table_name string) *modelField
func SafeAppend ¶
if value type is ptr to l elem type , try to get its elem and append to l if l elem type is ptr to x type , try to make x ptr and append to l
func SqlNameConvert ¶
column convert rule: User => user UserName => user_name UserID => user_id OneToOne => one_to_one
Types ¶
type AffectNode ¶
type AffectNode struct { Val int Ignore bool Next *AffectNode }
func IgnoreAffectNode ¶
func IgnoreAffectNode(next *AffectNode) *AffectNode
func NewAffectNode ¶
func NewAffectNode(val int, next *AffectNode) *AffectNode
type AssociationType ¶
type AssociationType int
const ( JoinWith AssociationType = iota BelongToWith OneToOneWith OneToManyWith AssociationTypeEnd )
func (AssociationType) String ¶
func (i AssociationType) String() string
type BelongToPreload ¶
type BelongToPreload struct { Model *Model SubModel *Model RelationField Field // used to save other table value ContainerField Field }
this is describe one to one relationship with table and its sub table e.g select * from sub_table where id = (table.RelationField).value
type BrickCommon ¶
type BrickCommon struct { Model *Model BelongToPreload map[string]*BelongToPreload OneToOnePreload map[string]*OneToOnePreload OneToManyPreload map[string]*OneToManyPreload ManyToManyPreload map[string]*ManyToManyPreload // use by find/scan/insert/update/replace/where ,if FieldsSelector[Mode] is set,then ignoreModeSelector will failure // FieldsSelector[ModeDefault] can work on all Mode when they specified Mode not set FieldsSelector [ModeEnd][]Field // contains filtered or unexported fields }
func (*BrickCommon) CopyBelongToPreload ¶
func (t *BrickCommon) CopyBelongToPreload() map[string]*BelongToPreload
func (*BrickCommon) CopyManyToManyPreload ¶
func (t *BrickCommon) CopyManyToManyPreload() map[string]*ManyToManyPreload
func (*BrickCommon) CopyOneToManyPreload ¶
func (t *BrickCommon) CopyOneToManyPreload() map[string]*OneToManyPreload
func (*BrickCommon) CopyOneToOnePreload ¶
func (t *BrickCommon) CopyOneToOnePreload() map[string]*OneToOnePreload
type CollectionBrick ¶
type CollectionBrick struct { Toy *ToyCollection MapPreloadBrick map[string]*CollectionBrick //orderBy []Column Search SearchList BrickCommon // contains filtered or unexported fields }
func NewCollectionBrick ¶
func NewCollectionBrick(toy *ToyCollection, model *Model) *CollectionBrick
func (*CollectionBrick) And ¶
func (t *CollectionBrick) And() CollectionBrickAnd
func (*CollectionBrick) BindDefaultFields ¶
func (t *CollectionBrick) BindDefaultFields(args ...interface{}) *CollectionBrick
func (*CollectionBrick) BindFields ¶
func (t *CollectionBrick) BindFields(mode Mode, args ...interface{}) *CollectionBrick
func (*CollectionBrick) Clone ¶
func (t *CollectionBrick) Clone() *CollectionBrick
func (*CollectionBrick) ConditionExec ¶
func (t *CollectionBrick) ConditionExec() ExecValue
func (*CollectionBrick) Conditions ¶
func (t *CollectionBrick) Conditions(search SearchList) *CollectionBrick
func (*CollectionBrick) CopyMapPreloadBrick ¶
func (t *CollectionBrick) CopyMapPreloadBrick() map[string]*CollectionBrick
func (*CollectionBrick) CopyStatus ¶
func (t *CollectionBrick) CopyStatus(statusBrick *CollectionBrick) *CollectionBrick
func (*CollectionBrick) Count ¶
func (t *CollectionBrick) Count() (count int, err error)
func (*CollectionBrick) CountExec ¶
func (t *CollectionBrick) CountExec() (exec ExecValue)
func (*CollectionBrick) CreateTable ¶
func (t *CollectionBrick) CreateTable() (*Result, error)
func (*CollectionBrick) CreateTableIfNotExist ¶
func (t *CollectionBrick) CreateTableIfNotExist() (*Result, error)
func (*CollectionBrick) CustomBelongToPreload ¶
func (t *CollectionBrick) CustomBelongToPreload(container, relationship interface{}, args ...interface{}) *CollectionBrick
func (*CollectionBrick) CustomManyToManyPreload ¶
func (t *CollectionBrick) CustomManyToManyPreload(middleStruct, container, relation, subRelation interface{}, args ...interface{}) *CollectionBrick
func (*CollectionBrick) CustomOneToManyPreload ¶
func (t *CollectionBrick) CustomOneToManyPreload(container, relationship interface{}, args ...interface{}) *CollectionBrick
func (*CollectionBrick) CustomOneToOnePreload ¶
func (t *CollectionBrick) CustomOneToOnePreload(container, relationship interface{}, args ...interface{}) *CollectionBrick
func (*CollectionBrick) DBIndex ¶
func (t *CollectionBrick) DBIndex(i int) *CollectionBrick
func (*CollectionBrick) Debug ¶
func (t *CollectionBrick) Debug() *CollectionBrick
func (*CollectionBrick) Delete ¶
func (t *CollectionBrick) Delete(v interface{}) (*Result, error)
func (*CollectionBrick) DeleteExec ¶
func (t *CollectionBrick) DeleteExec() ExecValue
func (*CollectionBrick) DeleteWithConditions ¶
func (t *CollectionBrick) DeleteWithConditions() (*Result, error)
func (*CollectionBrick) DropTable ¶
func (t *CollectionBrick) DropTable() (*Result, error)
func (*CollectionBrick) DropTableIfExist ¶
func (t *CollectionBrick) DropTableIfExist() (*Result, error)
func (*CollectionBrick) Enter ¶
func (t *CollectionBrick) Enter() *CollectionBrick
return it parent CollectionBrick it will panic when the parent CollectionBrick is nil
func (*CollectionBrick) Find ¶
func (t *CollectionBrick) Find(v interface{}) (*Result, error)
func (*CollectionBrick) FindExec ¶
func (t *CollectionBrick) FindExec(records ModelRecordFieldTypes) ExecValue
func (*CollectionBrick) GetContext ¶
func (t *CollectionBrick) GetContext(option string, records ModelRecords) *CollectionContext
func (*CollectionBrick) HasTable ¶
func (t *CollectionBrick) HasTable() ([]bool, error)
func (*CollectionBrick) IgnoreMode ¶
func (t *CollectionBrick) IgnoreMode(s Mode, ignore IgnoreMode) *CollectionBrick
func (*CollectionBrick) Insert ¶
func (t *CollectionBrick) Insert(v interface{}) (*Result, error)
insert can receive three type data struct map[offset]interface{} map[int]interface{} insert is difficult that have preload data
func (*CollectionBrick) InsertExec ¶
func (t *CollectionBrick) InsertExec(record ModelRecord) ExecValue
func (*CollectionBrick) Or ¶
func (t *CollectionBrick) Or() CollectionBrickOr
func (*CollectionBrick) Preload ¶
func (t *CollectionBrick) Preload(fv interface{}) *CollectionBrick
return
func (*CollectionBrick) QueryRow ¶
func (t *CollectionBrick) QueryRow(exec ExecValue, i int) *sql.Row
func (*CollectionBrick) RightValuePreload ¶
func (t *CollectionBrick) RightValuePreload(fv interface{}) *CollectionBrick
this module is get preload which is right middle field name in many-to-many mode it only use for sub model type is same with main model type e.g
User{ ID int `toyorm:"primary key"` Friend []User }
now the main model middle field name is L_UserID, sub model middle field name is R_UserID if you want to get preload with main model middle field name == R_UserID use RightValuePreload
func (*CollectionBrick) Save ¶
func (t *CollectionBrick) Save(v interface{}) (*Result, error)
func (*CollectionBrick) SaveExec ¶
func (t *CollectionBrick) SaveExec(record ModelRecord) ExecValue
func (*CollectionBrick) Scope ¶
func (t *CollectionBrick) Scope(fn func(*CollectionBrick) *CollectionBrick) *CollectionBrick
func (*CollectionBrick) Selector ¶
func (t *CollectionBrick) Selector(selector DBPrimarySelector) *CollectionBrick
func (*CollectionBrick) Template ¶
func (t *CollectionBrick) Template(temp string, args ...interface{}) *CollectionBrick
func (*CollectionBrick) USave ¶
func (t *CollectionBrick) USave(v interface{}) (*Result, error)
func (*CollectionBrick) Update ¶
func (t *CollectionBrick) Update(v interface{}) (*Result, error)
func (*CollectionBrick) UpdateExec ¶
func (t *CollectionBrick) UpdateExec(record ModelRecord) ExecValue
func (*CollectionBrick) Where ¶
func (t *CollectionBrick) Where(expr SearchExpr, key FieldSelection, v ...interface{}) *CollectionBrick
where will clean old condition
func (*CollectionBrick) WhereGroup ¶
func (t *CollectionBrick) WhereGroup(expr SearchExpr, group interface{}) *CollectionBrick
expr only support And/Or , group must be struct data or map[string]interface{}/map[uintptr]interface{}
type CollectionBrickAnd ¶
type CollectionBrickAnd struct {
Brick *CollectionBrick
}
func (CollectionBrickAnd) Condition ¶
func (t CollectionBrickAnd) Condition(expr SearchExpr, key FieldSelection, v ...interface{}) *CollectionBrick
func (CollectionBrickAnd) ConditionGroup ¶
func (t CollectionBrickAnd) ConditionGroup(expr SearchExpr, group interface{}) *CollectionBrick
func (CollectionBrickAnd) Conditions ¶
func (t CollectionBrickAnd) Conditions(search SearchList) *CollectionBrick
type CollectionBrickOr ¶
type CollectionBrickOr struct {
Brick *CollectionBrick
}
func (CollectionBrickOr) Condition ¶
func (t CollectionBrickOr) Condition(expr SearchExpr, key FieldSelection, v ...interface{}) *CollectionBrick
func (CollectionBrickOr) ConditionGroup ¶
func (t CollectionBrickOr) ConditionGroup(expr SearchExpr, group interface{}) *CollectionBrick
func (CollectionBrickOr) Conditions ¶
func (t CollectionBrickOr) Conditions(search SearchList) *CollectionBrick
type CollectionContext ¶
type CollectionContext struct { Brick *CollectionBrick Result *Result // contains filtered or unexported fields }
func NewCollectionContext ¶
func NewCollectionContext(handlers CollectionHandlersChain, brick *CollectionBrick, columns ModelRecords) *CollectionContext
func (*CollectionContext) Abort ¶
func (c *CollectionContext) Abort()
func (*CollectionContext) IsAborted ¶
func (c *CollectionContext) IsAborted() bool
func (*CollectionContext) Next ¶
func (c *CollectionContext) Next() error
func (*CollectionContext) Value ¶
func (c *CollectionContext) Value(v interface{}) interface{}
type CollectionExecAction ¶
type CollectionExecAction struct { //Type ResultType Exec ExecValue Result sql.Result Error error // contains filtered or unexported fields }
func (CollectionExecAction) AffectData ¶
func (r CollectionExecAction) AffectData() []int
func (CollectionExecAction) Err ¶
func (r CollectionExecAction) Err() error
func (CollectionExecAction) SetAffectData ¶
func (r CollectionExecAction) SetAffectData(d []int)
func (CollectionExecAction) String ¶
func (r CollectionExecAction) String() string
type CollectionHandlerFunc ¶
type CollectionHandlerFunc func(c *CollectionContext) error
type CollectionHandlersChain ¶
type CollectionHandlersChain []CollectionHandlerFunc
type CollectionQueryAction ¶
type CollectionQueryAction struct { Exec ExecValue Error []error // contains filtered or unexported fields }
func (CollectionQueryAction) AffectData ¶
func (r CollectionQueryAction) AffectData() []int
func (CollectionQueryAction) Err ¶
func (r CollectionQueryAction) Err() error
func (CollectionQueryAction) SetAffectData ¶
func (r CollectionQueryAction) SetAffectData(d []int)
func (CollectionQueryAction) String ¶
func (r CollectionQueryAction) String() string
type Column ¶
type Column interface {
Column() string // sql column declaration
}
func FindColumnFactory ¶
func FindColumnFactory(fieldTypes ModelRecordFieldTypes, brick *ToyBrick) ([]Column, func(ModelRecord) []interface{})
get columns and scanner generator
type ColumnName ¶
type ColumnNameValue ¶
type ColumnNameValue interface { ColumnName Value() reflect.Value }
type ColumnValue ¶
type Context ¶
func NewContext ¶
func NewContext(handlers HandlersChain, brick *ToyBrick, columns ModelRecords) *Context
type DBPrimarySelector ¶
type DBValSelector ¶
type DefaultDialect ¶
type DefaultDialect struct{}
func (DefaultDialect) AddForeignKey ¶
func (dia DefaultDialect) AddForeignKey(model, relationModel *Model, ForeignKeyField Field) ExecValue
func (DefaultDialect) ConditionExec ¶
func (dia DefaultDialect) ConditionExec(search SearchList, limit, offset int, orderBy []Column, groupBy []Column) ExecValue
func (DefaultDialect) CountExec ¶
func (dia DefaultDialect) CountExec(model *Model, alias string) ExecValue
func (DefaultDialect) CreateTable ¶
func (dia DefaultDialect) CreateTable(model *Model, foreign map[string]ForeignKey) (execlist []ExecValue)
use to test
func (DefaultDialect) DeleteExec ¶
func (dia DefaultDialect) DeleteExec(model *Model) (exec ExecValue)
func (DefaultDialect) DropForeignKey ¶
func (dia DefaultDialect) DropForeignKey(model *Model, ForeignKeyField Field) ExecValue
func (DefaultDialect) DropTable ¶
func (dia DefaultDialect) DropTable(m *Model) ExecValue
func (DefaultDialect) FindExec ¶
func (dia DefaultDialect) FindExec(model *Model, columns []Column, alias string) ExecValue
func (DefaultDialect) HasTable ¶
func (dia DefaultDialect) HasTable(model *Model) ExecValue
use to test
func (DefaultDialect) InsertExec ¶
func (dia DefaultDialect) InsertExec(model *Model, columnValues []ColumnNameValue) ExecValue
func (DefaultDialect) InsertExecutor ¶
func (DefaultDialect) JoinExec ¶
func (dia DefaultDialect) JoinExec(mainSwap *JoinSwap) ExecValue
func (DefaultDialect) SaveExec ¶
func (dia DefaultDialect) SaveExec(model *Model, columnValues []ColumnNameValue) ExecValue
func (DefaultDialect) SaveExecutor ¶
func (DefaultDialect) SearchExec ¶
func (dia DefaultDialect) SearchExec(s SearchList) ExecValue
func (DefaultDialect) TemplateExec ¶
func (DefaultDialect) UpdateExec ¶
func (dia DefaultDialect) UpdateExec(model *Model, columnValues []ColumnValue) ExecValue
type DefaultExec ¶
type DefaultExec struct {
// contains filtered or unexported fields
}
not process source str, Source() == Query()
func (DefaultExec) Append ¶
func (e DefaultExec) Append(query string, args ...interface{}) ExecValue
func (DefaultExec) Args ¶
func (e DefaultExec) Args() []interface{}
func (DefaultExec) JsonArgs ¶
func (e DefaultExec) JsonArgs() string
func (DefaultExec) Query ¶
func (e DefaultExec) Query() string
func (DefaultExec) Source ¶
func (e DefaultExec) Source() string
type Dialect ¶
type Dialect interface { // some database like postgres not support LastInsertId, need QueryRow to get the return id InsertExecutor(Executor, ExecValue, func(ExecValue, error)) (sql.Result, error) // sqlite3/postgresql use RowsAffected to check success or failure, but mysql can't, // because it's RowsAffected is zero when update value not change SaveExecutor(Executor, ExecValue, func(ExecValue, error)) (sql.Result, error) HasTable(*Model) ExecValue CreateTable(*Model, map[string]ForeignKey) []ExecValue DropTable(*Model) ExecValue ConditionExec(search SearchList, limit, offset int, orderBy []Column, groupBy []Column) ExecValue FindExec(model *Model, columns []Column, alias string) ExecValue UpdateExec(*Model, []ColumnValue) ExecValue DeleteExec(*Model) ExecValue InsertExec(*Model, []ColumnNameValue) ExecValue SaveExec(*Model, []ColumnNameValue) ExecValue AddForeignKey(model, relationModel *Model, ForeignKeyField Field) ExecValue DropForeignKey(model *Model, ForeignKeyField Field) ExecValue CountExec(model *Model, alias string) ExecValue SearchExec(search SearchList) ExecValue TemplateExec(BasicExec, map[string]BasicExec) (ExecValue, error) JoinExec(*JoinSwap) ExecValue }
type ErrCannotSet ¶
type ErrCannotSet struct {
Operation string
}
func (ErrCannotSet) Error ¶
func (e ErrCannotSet) Error() string
type ErrCollectionClose ¶
func (ErrCollectionClose) Error ¶
func (e ErrCollectionClose) Error() string
type ErrCollectionDBSelectorNotFound ¶
type ErrCollectionDBSelectorNotFound struct { }
func (ErrCollectionDBSelectorNotFound) Error ¶
func (e ErrCollectionDBSelectorNotFound) Error() string
type ErrCollectionExec ¶
func (ErrCollectionExec) Error ¶
func (e ErrCollectionExec) Error() string
type ErrCollectionQuery ¶
func (ErrCollectionQuery) Error ¶
func (e ErrCollectionQuery) Error() string
type ErrCollectionQueryRow ¶
func (ErrCollectionQueryRow) Error ¶
func (e ErrCollectionQueryRow) Error() string
type ErrDbIndexNotSet ¶
type ErrDbIndexNotSet struct{}
func (ErrDbIndexNotSet) Error ¶
func (e ErrDbIndexNotSet) Error() string
type ErrInvalidModelName ¶
type ErrInvalidModelName struct{}
func (ErrInvalidModelName) Error ¶
func (e ErrInvalidModelName) Error() string
type ErrInvalidModelType ¶
type ErrInvalidModelType string
func (ErrInvalidModelType) Error ¶
func (e ErrInvalidModelType) Error() string
type ErrInvalidPreloadField ¶
func (ErrInvalidPreloadField) Error ¶
func (e ErrInvalidPreloadField) Error() string
type ErrInvalidRecordType ¶
type ErrInvalidRecordType struct { }
func (ErrInvalidRecordType) Error ¶
func (e ErrInvalidRecordType) Error() string
type ErrLastInsertId ¶
type ErrLastInsertId struct{}
func (ErrLastInsertId) Error ¶
func (e ErrLastInsertId) Error() string
type ErrModelDuplicateAssociation ¶
type ErrModelDuplicateAssociation struct { Model string Type AssociationType Name string }
func (ErrModelDuplicateAssociation) Error ¶
func (e ErrModelDuplicateAssociation) Error() string
type ErrNilPrimaryKey ¶
type ErrNilPrimaryKey struct{}
func (ErrNilPrimaryKey) Error ¶
func (e ErrNilPrimaryKey) Error() string
type ErrNotSupportRowsAffected ¶
type ErrNotSupportRowsAffected struct{}
func (ErrNotSupportRowsAffected) Error ¶
func (e ErrNotSupportRowsAffected) Error() string
type ErrRepeatField ¶
func (ErrRepeatField) Error ¶
func (e ErrRepeatField) Error() string
type ErrSameColumnName ¶
type ErrSameColumnName struct { ModelName string Same string OldFieldName string NewFieldName string }
func (ErrSameColumnName) Error ¶
func (e ErrSameColumnName) Error() string
type ErrSaveFailure ¶
type ErrSaveFailure struct{}
func (ErrSaveFailure) Error ¶
func (e ErrSaveFailure) Error() string
type ErrTemplateExecInvalidWord ¶
type ErrTemplateExecInvalidWord struct {
Word string
}
func (ErrTemplateExecInvalidWord) Error ¶
func (e ErrTemplateExecInvalidWord) Error() string
type ErrZeroPrimaryKey ¶
type ErrZeroPrimaryKey struct{ Model *Model }
func (ErrZeroPrimaryKey) Error ¶
func (e ErrZeroPrimaryKey) Error() string
type ExecAction ¶
type ExecAction struct { //Type ResultType Exec ExecValue Result sql.Result Error error // contains filtered or unexported fields }
func (ExecAction) AffectData ¶
func (r ExecAction) AffectData() []int
func (ExecAction) Err ¶
func (r ExecAction) Err() error
func (ExecAction) SetAffectData ¶
func (r ExecAction) SetAffectData(d []int)
func (ExecAction) String ¶
func (r ExecAction) String() string
type Field ¶
type Field interface { Column // sql column declaration Name() string // get field name Offset() uintptr // relation position by model struct IsPrimary() bool // primary key declaration AutoIncrement() bool // auto increment declaration Index() string // sql index declaration UniqueIndex() string // sql unique index declaration IsForeign() bool // sql foreign declaration Attr(string) string // extension attribute declaration Attrs() map[string]string // get all extension attribute SqlType() string // sql type declaration StructField() reflect.StructField // model struct attribute FieldValue() reflect.Value // model meta field value JoinWith() string // join with specified container field declaration,when call ToyBrick.Preload(<container field>) will automatic association this field BelongToWith() string // BelongTo with specified container field declaration,ToyBrick.Preload(<container field>) will automatic association this field OneToOneWith() string // OneToOne with specified container field declaration,ToyBrick.Preload(<container field>) will automatic association this field OneToManyWith() string // OneToMany with specified container field declaration,ToyBrick.Preload(<container field>) will automatic association this field Source() Field ToColumnAlias(alias string) Field ToFieldValue(value reflect.Value) FieldValue }
func GetMiddleField ¶
type FieldSelection ¶
type FieldSelection interface{}
type FieldValue ¶
type FieldValueList ¶
type FieldValueList []FieldValue
func (FieldValueList) ToNameValueList ¶
func (l FieldValueList) ToNameValueList() []ColumnNameValue
func (FieldValueList) ToValueList ¶
func (l FieldValueList) ToValueList() []ColumnValue
type ForeignKey ¶
type HandlerFunc ¶
type HandlersChain ¶
type HandlersChain []HandlerFunc
type IgnoreMode ¶
type IgnoreMode int
type JoinSwap ¶
type JoinSwap struct { OwnOrderBy []int OwnGroupBy []int OwnSearch []int Alias string FieldsSelector [ModeEnd][]Field SwapMap map[string]*JoinSwap JoinMap map[string]*Join MapPreloadBrick map[string]*ToyBrick BelongToPreload map[string]*BelongToPreload OneToOnePreload map[string]*OneToOnePreload OneToManyPreload map[string]*OneToManyPreload ManyToManyPreload map[string]*ManyToManyPreload }
join will replace attribute
func NewJoinSwap ¶
type ManyToManyPreload ¶
type ManyToManyPreload struct { MiddleModel *Model Model *Model SubModel *Model ContainerField Field RelationField Field SubRelationField Field }
this is describe many to many relationship with table and its sub table e.g select * from middle_table where table.id = table.id and sub_table.id = (table.RelationField).value
type Model ¶
type Model struct { Name string ReflectType reflect.Type AllFields []*modelField SqlFields []*modelField OffsetFields map[uintptr]*modelField NameFields map[string]*modelField SqlFieldMap map[string]*modelField PrimaryFields []*modelField IndexFields map[string][]*modelField UniqueIndexFields map[string][]*modelField StructFieldFields map[reflect.Type][]*modelField Association [AssociationTypeEnd]map[string]*modelField }
table struct used to save all sql attribute with struct column is table name attribute AllFields is all struct field and it's Anonymous struct SqlFields is all about sql field OffsetFields is map field offset NameFields is map field name PrimaryFields is all about primary key field IndexFields is all about index fields UniqueIndexFields is all about unique index fields StructFieldFields is map unknown struct type or slice struct type
func NewMiddleModel ¶
func (*Model) GetFieldWithName ¶
func (*Model) GetIndexMap ¶
func (*Model) GetNameFieldMap ¶
func (*Model) GetOffsetField ¶
func (*Model) GetOffsetFieldMap ¶
func (*Model) GetOnePrimary ¶
func (*Model) GetPosField ¶
func (*Model) GetPosFields ¶
func (*Model) GetPrimary ¶
func (*Model) GetSqlFields ¶
func (*Model) GetUniqueIndexMap ¶
type ModelDefault ¶
type ModelGroupBy ¶
type ModelGroupBy map[interface{}][]ModelIndexRecord
func (ModelGroupBy) Keys ¶
func (m ModelGroupBy) Keys() []interface{}
type ModelIndexRecord ¶
type ModelIndexRecord struct { ModelRecord Index int }
type ModelNameMapRecord ¶
type ModelNameMapRecord struct { FieldValues map[string]reflect.Value // contains filtered or unexported fields }
func NewNameMapRecord ¶
func NewNameMapRecord(model *Model, v reflect.Value) *ModelNameMapRecord
func (*ModelNameMapRecord) AllField ¶
func (m *ModelNameMapRecord) AllField() map[string]reflect.Value
func (*ModelNameMapRecord) DeleteField ¶
func (m *ModelNameMapRecord) DeleteField(name string)
func (*ModelNameMapRecord) FieldAddress ¶
func (m *ModelNameMapRecord) FieldAddress(name string) reflect.Value
func (*ModelNameMapRecord) GetFieldType ¶
func (m *ModelNameMapRecord) GetFieldType(name string) reflect.Type
func (*ModelNameMapRecord) IsVariableContainer ¶
func (m *ModelNameMapRecord) IsVariableContainer() bool
func (*ModelNameMapRecord) SetField ¶
func (m *ModelNameMapRecord) SetField(name string, value reflect.Value)
func (*ModelNameMapRecord) Source ¶
func (m *ModelNameMapRecord) Source() reflect.Value
type ModelNameMapRecords ¶
type ModelNameMapRecords struct { FieldValuesList []map[string]reflect.Value // contains filtered or unexported fields }
func NewNameMapRecords ¶
func NewNameMapRecords(model *Model, v reflect.Value) *ModelNameMapRecords
func (*ModelNameMapRecords) Add ¶
func (m *ModelNameMapRecords) Add(v reflect.Value) ModelRecord
func (*ModelNameMapRecords) ElemType ¶
func (m *ModelNameMapRecords) ElemType() reflect.Type
func (*ModelNameMapRecords) GetFieldAddressType ¶
func (m *ModelNameMapRecords) GetFieldAddressType(name string) reflect.Type
func (*ModelNameMapRecords) GetFieldType ¶
func (m *ModelNameMapRecords) GetFieldType(name string) reflect.Type
func (*ModelNameMapRecords) GetRecord ¶
func (m *ModelNameMapRecords) GetRecord(i int) ModelRecord
func (*ModelNameMapRecords) GetRecords ¶
func (m *ModelNameMapRecords) GetRecords() []ModelRecord
func (*ModelNameMapRecords) GroupBy ¶
func (m *ModelNameMapRecords) GroupBy(key string) ModelGroupBy
func (*ModelNameMapRecords) GroupByFunc ¶
func (m *ModelNameMapRecords) GroupByFunc(key string, fn func(int, ModelRecord))
func (*ModelNameMapRecords) IsVariableContainer ¶
func (m *ModelNameMapRecords) IsVariableContainer() bool
func (*ModelNameMapRecords) Len ¶
func (m *ModelNameMapRecords) Len() int
func (*ModelNameMapRecords) Source ¶
func (m *ModelNameMapRecords) Source() reflect.Value
type ModelOffsetMapRecord ¶
type ModelOffsetMapRecord struct { FieldValues map[string]reflect.Value // contains filtered or unexported fields }
func NewOffsetMapRecord ¶
func NewOffsetMapRecord(model *Model, v reflect.Value) *ModelOffsetMapRecord
func (*ModelOffsetMapRecord) AllField ¶
func (m *ModelOffsetMapRecord) AllField() map[string]reflect.Value
func (*ModelOffsetMapRecord) DeleteField ¶
func (m *ModelOffsetMapRecord) DeleteField(name string)
func (*ModelOffsetMapRecord) Field ¶
func (m *ModelOffsetMapRecord) Field(name string) reflect.Value
func (*ModelOffsetMapRecord) FieldAddress ¶
func (m *ModelOffsetMapRecord) FieldAddress(name string) reflect.Value
func (*ModelOffsetMapRecord) GetFieldType ¶
func (m *ModelOffsetMapRecord) GetFieldType(name string) reflect.Type
func (*ModelOffsetMapRecord) IsVariableContainer ¶
func (m *ModelOffsetMapRecord) IsVariableContainer() bool
func (*ModelOffsetMapRecord) SetField ¶
func (m *ModelOffsetMapRecord) SetField(name string, value reflect.Value)
func (*ModelOffsetMapRecord) Source ¶
func (m *ModelOffsetMapRecord) Source() reflect.Value
type ModelOffsetMapRecords ¶
type ModelOffsetMapRecords struct { FieldValuesList []map[string]reflect.Value // contains filtered or unexported fields }
func NewOffsetMapRecords ¶
func NewOffsetMapRecords(model *Model, m reflect.Value) *ModelOffsetMapRecords
func (*ModelOffsetMapRecords) Add ¶
func (m *ModelOffsetMapRecords) Add(v reflect.Value) ModelRecord
func (*ModelOffsetMapRecords) ElemType ¶
func (m *ModelOffsetMapRecords) ElemType() reflect.Type
func (*ModelOffsetMapRecords) GetFieldAddressType ¶
func (m *ModelOffsetMapRecords) GetFieldAddressType(name string) reflect.Type
func (*ModelOffsetMapRecords) GetFieldType ¶
func (m *ModelOffsetMapRecords) GetFieldType(name string) reflect.Type
func (*ModelOffsetMapRecords) GetRecord ¶
func (m *ModelOffsetMapRecords) GetRecord(i int) ModelRecord
func (*ModelOffsetMapRecords) GetRecords ¶
func (m *ModelOffsetMapRecords) GetRecords() []ModelRecord
func (*ModelOffsetMapRecords) GroupBy ¶
func (m *ModelOffsetMapRecords) GroupBy(key string) ModelGroupBy
func (*ModelOffsetMapRecords) IsVariableContainer ¶
func (m *ModelOffsetMapRecords) IsVariableContainer() bool
func (*ModelOffsetMapRecords) Len ¶
func (m *ModelOffsetMapRecords) Len() int
func (*ModelOffsetMapRecords) Source ¶
func (m *ModelOffsetMapRecords) Source() reflect.Value
type ModelRecord ¶
type ModelRecord interface { AllField() map[string]reflect.Value SetField(field string, v reflect.Value) DeleteField(string) Field(field string) reflect.Value FieldAddress(field string) reflect.Value IsVariableContainer() bool Source() reflect.Value GetFieldType(string) reflect.Type }
func MakeRecord ¶
func MakeRecord(model *Model, _type reflect.Type) ModelRecord
func NewStructRecord ¶
func NewStructRecord(model *Model, value reflect.Value) ModelRecord
type ModelRecordFieldTypes ¶
type ModelRecords ¶
type ModelRecords interface { GetRecord(int) ModelRecord GetRecords() []ModelRecord Add(v reflect.Value) ModelRecord GetFieldType(string) reflect.Type GetFieldAddressType(string) reflect.Type IsVariableContainer() bool ElemType() reflect.Type Len() int Source() reflect.Value GroupBy(key string) ModelGroupBy }
func MakeRecords ¶
func MakeRecords(model *Model, _type reflect.Type) ModelRecords
func MakeRecordsWithElem ¶
func MakeRecordsWithElem(model *Model, _type reflect.Type) ModelRecords
use element type to create ModelRecords
func NewRecords ¶
func NewRecords(model *Model, value reflect.Value) ModelRecords
type ModelStructRecord ¶
type ModelStructRecord struct { FieldValues map[string]reflect.Value VirtualFieldValues map[string]reflect.Value // contains filtered or unexported fields }
func (*ModelStructRecord) AllField ¶
func (m *ModelStructRecord) AllField() map[string]reflect.Value
func (*ModelStructRecord) DeleteField ¶
func (m *ModelStructRecord) DeleteField(name string)
func (*ModelStructRecord) FieldAddress ¶
func (m *ModelStructRecord) FieldAddress(name string) reflect.Value
func (*ModelStructRecord) GetFieldType ¶
func (m *ModelStructRecord) GetFieldType(name string) reflect.Type
func (*ModelStructRecord) IsVariableContainer ¶
func (m *ModelStructRecord) IsVariableContainer() bool
func (*ModelStructRecord) SetField ¶
func (m *ModelStructRecord) SetField(name string, value reflect.Value)
set field to field value map or virtual field value map but if value is invalid delete it on map
func (*ModelStructRecord) Source ¶
func (m *ModelStructRecord) Source() reflect.Value
type ModelStructRecords ¶
type ModelStructRecords struct { Type reflect.Type RelationFieldPos map[string]int FieldTypes map[string]reflect.Type FieldValuesList []map[string]reflect.Value VirtualFieldValuesList []map[string]reflect.Value // contains filtered or unexported fields }
func NewStructRecords ¶
func NewStructRecords(model *Model, value reflect.Value) *ModelStructRecords
func (*ModelStructRecords) Add ¶
func (m *ModelStructRecords) Add(v reflect.Value) ModelRecord
func (*ModelStructRecords) ElemType ¶
func (m *ModelStructRecords) ElemType() reflect.Type
func (*ModelStructRecords) GetFieldAddressType ¶
func (m *ModelStructRecords) GetFieldAddressType(field string) reflect.Type
func (*ModelStructRecords) GetFieldType ¶
func (m *ModelStructRecords) GetFieldType(field string) reflect.Type
func (*ModelStructRecords) GetRecord ¶
func (m *ModelStructRecords) GetRecord(i int) ModelRecord
func (*ModelStructRecords) GetRecords ¶
func (m *ModelStructRecords) GetRecords() []ModelRecord
func (*ModelStructRecords) GroupBy ¶
func (m *ModelStructRecords) GroupBy(key string) ModelGroupBy
func (*ModelStructRecords) IsVariableContainer ¶
func (m *ModelStructRecords) IsVariableContainer() bool
func (*ModelStructRecords) Len ¶
func (m *ModelStructRecords) Len() int
func (*ModelStructRecords) Source ¶
func (m *ModelStructRecords) Source() reflect.Value
type MySqlDialect ¶
type MySqlDialect struct {
DefaultDialect
}
func (MySqlDialect) CreateTable ¶
func (dia MySqlDialect) CreateTable(model *Model, foreign map[string]ForeignKey) (execlist []ExecValue)
func (MySqlDialect) HasTable ¶
func (dia MySqlDialect) HasTable(model *Model) ExecValue
func (MySqlDialect) SaveExec ¶
func (dia MySqlDialect) SaveExec(model *Model, columnValues []ColumnNameValue) ExecValue
replace will failure when have foreign key
func (MySqlDialect) SaveExecutor ¶
type OneToManyPreload ¶
type OneToManyPreload struct { Model *Model SubModel *Model RelationField Field ContainerField Field }
this is describe one to many relationship with table and its sub table e.g select * from sub_table where sub_table.RelationField = table.id
type OneToOnePreload ¶
type OneToOnePreload struct { Model *Model SubModel *Model RelationField Field // used to save other table value ContainerField Field }
this is describe one to one relationship with table and its sub table e.g select * from sub_table where sub_table.RelationField = table.id;
type PostgreSqlDialect ¶
type PostgreSqlDialect struct {
DefaultDialect
}
func (PostgreSqlDialect) AddForeignKey ¶
func (dia PostgreSqlDialect) AddForeignKey(model, relationModel *Model, ForeignKeyField Field) ExecValue
func (PostgreSqlDialect) ConditionExec ¶
func (dia PostgreSqlDialect) ConditionExec(search SearchList, limit, offset int, orderBy []Column, groupBy []Column) ExecValue
func (PostgreSqlDialect) CountExec ¶
func (dia PostgreSqlDialect) CountExec(model *Model, alias string) ExecValue
func (PostgreSqlDialect) CreateTable ¶
func (dia PostgreSqlDialect) CreateTable(model *Model, foreign map[string]ForeignKey) (execlist []ExecValue)
func (PostgreSqlDialect) DeleteExec ¶
func (dia PostgreSqlDialect) DeleteExec(model *Model) (exec ExecValue)
func (PostgreSqlDialect) DropForeignKey ¶
func (dia PostgreSqlDialect) DropForeignKey(model *Model, ForeignKeyField Field) ExecValue
func (PostgreSqlDialect) DropTable ¶
func (dia PostgreSqlDialect) DropTable(m *Model) ExecValue
func (PostgreSqlDialect) FindExec ¶
func (dia PostgreSqlDialect) FindExec(model *Model, columns []Column, alias string) ExecValue
func (PostgreSqlDialect) HasTable ¶
func (dia PostgreSqlDialect) HasTable(model *Model) ExecValue
func (PostgreSqlDialect) InsertExec ¶
func (dia PostgreSqlDialect) InsertExec(model *Model, columnValues []ColumnNameValue) ExecValue
func (PostgreSqlDialect) InsertExecutor ¶
func (PostgreSqlDialect) JoinExec ¶
func (dia PostgreSqlDialect) JoinExec(mainSwap *JoinSwap) ExecValue
func (PostgreSqlDialect) SaveExec ¶
func (dia PostgreSqlDialect) SaveExec(model *Model, columnNameValues []ColumnNameValue) ExecValue
postgres have not replace use ON CONFLICT(%s) replace
func (PostgreSqlDialect) SearchExec ¶
func (dia PostgreSqlDialect) SearchExec(s SearchList) ExecValue
func (PostgreSqlDialect) TemplateExec ¶
func (PostgreSqlDialect) UpdateExec ¶
func (dia PostgreSqlDialect) UpdateExec(model *Model, columnValues []ColumnValue) ExecValue
type PreCollectionBrick ¶
type PreCollectionBrick struct { Parent *CollectionBrick Field Field }
type PreJoinSwap ¶
type PreJoinSwap struct { Swap *JoinSwap PreSwap *PreJoinSwap Model *Model Field Field }
type PreToyBrick ¶
type QToSExec ¶
type QToSExec struct {
DefaultExec
}
when call Query() method, all '?' in query will replace to '$1','$2'...
type QueryAction ¶
func (QueryAction) AffectData ¶
func (r QueryAction) AffectData() []int
func (QueryAction) Err ¶
func (r QueryAction) Err() error
func (QueryAction) SetAffectData ¶
func (r QueryAction) SetAffectData(d []int)
func (QueryAction) String ¶
func (r QueryAction) String() string
type ReportData ¶
type ReportData struct { Depth int AffectData []*AffectNode Str string }
type Result ¶
type Result struct { Records ModelRecords ActionFlow []SqlAction RecordsActions map[int][]int Preload map[string]*Result // container is simple object SimpleRelation map[string]map[int]int // container is slice object MultipleRelation map[string]map[int]Pair // in many-to-many model, have a middle model query need to record MiddleModelPreload map[string]*Result }
type SearchCell ¶
type SearchCell struct { Type SearchExpr Val FieldValue }
func NewSearchBranch ¶
func NewSearchBranch(op SearchExpr) SearchCell
func NewSearchLeaf ¶
func NewSearchLeaf(op SearchExpr, columnValue FieldValue) SearchCell
type SearchExpr ¶
type SearchExpr string
func (SearchExpr) IsBranch ¶
func (op SearchExpr) IsBranch() bool
type SearchList ¶
type SearchList []SearchCell
func (SearchList) Condition ¶
func (s SearchList) Condition(columnValue FieldValue, expr, linkExpr SearchExpr) SearchList
type SearchTree ¶
type SearchTree struct { Val SearchCell Left *SearchTree Right *SearchTree }
func NewSearchTree ¶
func NewSearchTree(val SearchCell) *SearchTree
func (*SearchTree) Fill ¶
func (s *SearchTree) Fill(left, right *SearchTree) *SearchTree
func (*SearchTree) ToStack ¶
func (s *SearchTree) ToStack() SearchList
type Sqlite3Dialect ¶
type Sqlite3Dialect struct {
DefaultDialect
}
func (Sqlite3Dialect) CreateTable ¶
func (dia Sqlite3Dialect) CreateTable(model *Model, foreign map[string]ForeignKey) (execlist []ExecValue)
func (Sqlite3Dialect) HasTable ¶
func (dia Sqlite3Dialect) HasTable(model *Model) ExecValue
func (Sqlite3Dialect) SaveExec ¶
func (dia Sqlite3Dialect) SaveExec(model *Model, columnValues []ColumnNameValue) ExecValue
type Toy ¶
type Toy struct { DefaultHandlerChain map[string]HandlersChain DefaultModelHandlerChain map[reflect.Type]map[string]HandlersChain ToyKernel // contains filtered or unexported fields }
func (*Toy) BelongToBind ¶
func (t *Toy) BelongToBind(model, subModel *Model, containerField, relationField Field) *BelongToPreload
func (*Toy) BelongToPreload ¶
func (t *Toy) BelongToPreload(model *Model, field Field) *BelongToPreload
func (*Toy) ManyToManyPreload ¶
func (t *Toy) ManyToManyPreload(model *Model, field Field, isRight bool) *ManyToManyPreload
func (*Toy) ManyToManyPreloadBind ¶
func (t *Toy) ManyToManyPreloadBind(model, subModel, middleModel *Model, containerField, relationField, subRelationField Field) *ManyToManyPreload
func (*Toy) MiddleModel ¶
func (*Toy) ModelHandlers ¶
func (t *Toy) ModelHandlers(option string, model *Model) HandlersChain
func (*Toy) OneToManyBind ¶
func (t *Toy) OneToManyBind(model, subModel *Model, containerField, relationField Field) *OneToManyPreload
func (*Toy) OneToManyPreload ¶
func (t *Toy) OneToManyPreload(model *Model, field Field) *OneToManyPreload
func (*Toy) OneToOneBind ¶
func (t *Toy) OneToOneBind(model, subModel *Model, containerField, relationField Field) *OneToOnePreload
func (*Toy) OneToOnePreload ¶
func (t *Toy) OneToOnePreload(model *Model, field Field) *OneToOnePreload
type ToyBrick ¶
type ToyBrick struct { Toy *Toy MapPreloadBrick map[string]*ToyBrick Search SearchList OwnOrderBy []int OwnGroupBy []int OwnSearch []int SwapMap map[string]*JoinSwap JoinMap map[string]*Join BrickCommon // contains filtered or unexported fields }
func NewToyBrick ¶
func (*ToyBrick) And ¶
func (t *ToyBrick) And() ToyBrickAnd
func (*ToyBrick) BindDefaultFields ¶
func (t *ToyBrick) BindDefaultFields(args ...FieldSelection) *ToyBrick
func (*ToyBrick) BindFields ¶
func (*ToyBrick) CleanOwnGroupBy ¶
func (*ToyBrick) CleanOwnOrderBy ¶
func (*ToyBrick) CleanOwnSearch ¶
func (*ToyBrick) ConditionExec ¶
func (*ToyBrick) Conditions ¶
func (t *ToyBrick) Conditions(search SearchList) *ToyBrick
func (*ToyBrick) CopyJoinSwap ¶
func (*ToyBrick) CopyMapPreloadBrick ¶
func (*ToyBrick) CopyStatus ¶
func (*ToyBrick) CreateTable ¶
func (*ToyBrick) CreateTableIfNotExist ¶
func (*ToyBrick) CustomBelongToPreload ¶
func (t *ToyBrick) CustomBelongToPreload(container, relationship FieldSelection, args ...interface{}) *ToyBrick
func (*ToyBrick) CustomManyToManyPreload ¶
func (t *ToyBrick) CustomManyToManyPreload(middleStruct interface{}, container FieldSelection, relation, subRelation interface{}, args ...interface{}) *ToyBrick
func (*ToyBrick) CustomOneToManyPreload ¶
func (t *ToyBrick) CustomOneToManyPreload(container FieldSelection, relationship interface{}, args ...interface{}) *ToyBrick
func (*ToyBrick) CustomOneToOnePreload ¶
func (t *ToyBrick) CustomOneToOnePreload(container FieldSelection, relationship interface{}, args ...interface{}) *ToyBrick
func (*ToyBrick) DeleteExec ¶
func (*ToyBrick) DeleteWithConditions ¶
func (*ToyBrick) DropTableIfExist ¶
func (*ToyBrick) GetContext ¶
func (t *ToyBrick) GetContext(option string, records ModelRecords) *Context
func (*ToyBrick) GroupBy ¶
func (t *ToyBrick) GroupBy(vList ...FieldSelection) *ToyBrick
func (*ToyBrick) IgnoreMode ¶
func (t *ToyBrick) IgnoreMode(s Mode, ignore IgnoreMode) *ToyBrick
func (*ToyBrick) Insert ¶
insert can receive three type data struct map[offset]interface{} map[int]interface{} insert is difficult that have preload data
func (*ToyBrick) InsertExec ¶
func (t *ToyBrick) InsertExec(record ModelRecord) ExecValue
func (*ToyBrick) Join ¶
func (t *ToyBrick) Join(fv FieldSelection) *ToyBrick
use join to association query
func (*ToyBrick) Or ¶
func (t *ToyBrick) Or() ToyBrickOr
func (*ToyBrick) OrderBy ¶
func (t *ToyBrick) OrderBy(vList ...FieldSelection) *ToyBrick
func (*ToyBrick) RightValuePreload ¶
func (t *ToyBrick) RightValuePreload(fv FieldSelection) *ToyBrick
this module is get preload which is right middle field name in many-to-many mode it only use for sub model type is same with main model type e.g
User{ ID int `toyorm:"primary key"` Friend []User }
now the main model middle field name is L_UserID, sub model middle field name is R_UserID if you want to get preload with main model middle field name == R_UserID use RightValuePreload
func (*ToyBrick) SaveExec ¶
func (t *ToyBrick) SaveExec(record ModelRecord) ExecValue
func (*ToyBrick) UpdateExec ¶
func (t *ToyBrick) UpdateExec(record ModelRecord) ExecValue
func (*ToyBrick) Where ¶
func (t *ToyBrick) Where(expr SearchExpr, key FieldSelection, v ...interface{}) *ToyBrick
where will clean old condition
func (*ToyBrick) WhereGroup ¶
func (t *ToyBrick) WhereGroup(expr SearchExpr, group interface{}) *ToyBrick
expr only support And/Or , group must be struct data or map[string]interface{}/map[uintptr]interface{}
type ToyBrickAnd ¶
type ToyBrickAnd struct {
Brick *ToyBrick
}
func (ToyBrickAnd) Condition ¶
func (t ToyBrickAnd) Condition(expr SearchExpr, key FieldSelection, v ...interface{}) *ToyBrick
func (ToyBrickAnd) ConditionGroup ¶
func (t ToyBrickAnd) ConditionGroup(expr SearchExpr, group interface{}) *ToyBrick
func (ToyBrickAnd) Conditions ¶
func (t ToyBrickAnd) Conditions(search SearchList) *ToyBrick
type ToyBrickOr ¶
type ToyBrickOr struct {
Brick *ToyBrick
}
func (ToyBrickOr) Condition ¶
func (t ToyBrickOr) Condition(expr SearchExpr, key FieldSelection, v ...interface{}) *ToyBrick
func (ToyBrickOr) ConditionGroup ¶
func (t ToyBrickOr) ConditionGroup(expr SearchExpr, group interface{}) *ToyBrick
func (ToyBrickOr) Conditions ¶
func (t ToyBrickOr) Conditions(search SearchList) *ToyBrick
type ToyCollection ¶
type ToyCollection struct { DefaultHandlerChain map[string]CollectionHandlersChain DefaultModelHandlerChain map[reflect.Type]map[string]CollectionHandlersChain ToyKernel // contains filtered or unexported fields }
func OpenCollection ¶
func OpenCollection(driverName string, dataSourceName ...string) (*ToyCollection, error)
func (*ToyCollection) BelongToBind ¶
func (t *ToyCollection) BelongToBind(model, subModel *Model, containerField, relationField Field) *BelongToPreload
func (*ToyCollection) BelongToPreload ¶
func (t *ToyCollection) BelongToPreload(model *Model, field Field) *BelongToPreload
func (*ToyCollection) Close ¶
func (t *ToyCollection) Close() error
func (*ToyCollection) ManyToManyPreload ¶
func (t *ToyCollection) ManyToManyPreload(model *Model, field Field, isRight bool) *ManyToManyPreload
func (*ToyCollection) ManyToManyPreloadBind ¶
func (t *ToyCollection) ManyToManyPreloadBind(model, subModel, middleModel *Model, containerField, relationField, subRelationField Field) *ManyToManyPreload
func (*ToyCollection) MiddleModel ¶
func (t *ToyCollection) MiddleModel(v, sv interface{}) *CollectionBrick
func (*ToyCollection) Model ¶
func (t *ToyCollection) Model(v interface{}) *CollectionBrick
func (*ToyCollection) ModelHandlers ¶
func (t *ToyCollection) ModelHandlers(option string, model *Model) CollectionHandlersChain
func (*ToyCollection) OneToManyBind ¶
func (t *ToyCollection) OneToManyBind(model, subModel *Model, containerField, relationField Field) *OneToManyPreload
func (*ToyCollection) OneToManyPreload ¶
func (t *ToyCollection) OneToManyPreload(model *Model, field Field) *OneToManyPreload
func (*ToyCollection) OneToOneBind ¶
func (t *ToyCollection) OneToOneBind(model, subModel *Model, containerField, relationField Field) *OneToOnePreload
func (*ToyCollection) OneToOnePreload ¶
func (t *ToyCollection) OneToOnePreload(model *Model, field Field) *OneToOnePreload
func (*ToyCollection) SetModelHandlers ¶
func (t *ToyCollection) SetModelHandlers(option string, model *Model, handlers CollectionHandlersChain)
Source Files ¶
- associationtype_string.go
- basic.go
- brick_common.go
- collection.go
- collection_brick.go
- collection_brick_condition.go
- collection_handlers.go
- column.go
- context.go
- dialect.go
- dialect_mysql.go
- dialect_postgres.go
- dialect_sqlite.go
- errors.go
- exec.go
- handlers.go
- ignore_mode.go
- join.go
- mode.go
- model.go
- model_field.go
- preload.go
- record.go
- record_namemap.go
- record_offsetmap.go
- record_struct.go
- result.go
- search.go
- toy.go
- toy_brick.go
- toy_brick_condition.go
- toy_kernel.go