Documentation
¶
Index ¶
- Variables
- func Add(model interface{}, columns ...string) sql.Result
- func BatchInsert(models interface{}, columns ...string)
- func BatchReplace(models interface{}, columns ...string)
- func Commit()
- func Count(s *SQL) int
- func Del(model interface{}) sql.Result
- func Delete(s *SQL, model interface{}) sql.Result
- func Exec(query string, args ...interface{}) sql.Result
- func ForeignKey(sources interface{}, fk_column string, models interface{}, pk_column string, ...)
- func Get(model interface{}, columns ...string) bool
- func GetBy(model interface{}, columns ...string) bool
- func Insert(model interface{}, columns ...string) sql.Result
- func Query(query string, args ...interface{}) *sql.Rows
- func QueryRow(query string, args ...interface{}) *sql.Row
- func Replace(model interface{}, columns ...string) sql.Result
- func Rollback()
- func Save(model interface{}, columns ...string) sql.Result
- func Select(s *SQL, model interface{}, columns ...string) bool
- func SelectVal(s *SQL, vals ...interface{}) bool
- func SetDB(db *sql.DB)
- func SetPrefix(prefix string)
- func Up(model interface{}, columns ...string) sql.Result
- func Update(s *SQL, model interface{}, columns ...string) sql.Result
- type ModelField
- type ModelInfo
- type ModelInfoManager
- type ORM
- func (o *ORM) Add(model interface{}, columns ...string) sql.Result
- func (o *ORM) BatchInsert(models interface{}, columns ...string)
- func (o *ORM) BatchReplace(models interface{}, columns ...string)
- func (o *ORM) Begin() *ORM
- func (o *ORM) Commit()
- func (o *ORM) Count(s *SQL) int
- func (o *ORM) Del(model interface{}) sql.Result
- func (o *ORM) Delete(s *SQL, model interface{}) sql.Result
- func (o *ORM) Exec(query string, args ...interface{}) sql.Result
- func (o *ORM) ForeignKey(sources interface{}, fk_column string, models interface{}, pk_column string, ...)
- func (o *ORM) Get(model interface{}, columns ...string) bool
- func (o *ORM) GetBy(model interface{}, columns ...string) bool
- func (o *ORM) Insert(model interface{}, columns ...string) sql.Result
- func (o *ORM) Manager() *ModelInfoManager
- func (o *ORM) NewManager()
- func (o *ORM) NewSQL() *SQL
- func (o *ORM) Query(query string, args ...interface{}) *sql.Rows
- func (o *ORM) QueryRow(query string, args ...interface{}) *sql.Row
- func (o *ORM) RawAdd(model interface{}, columns ...string) (sql.Result, error)
- func (o *ORM) RawBatchInsert(models interface{}, columns ...string) error
- func (o *ORM) RawBatchReplace(models interface{}, columns ...string) error
- func (o *ORM) RawBegin() (*ORM, error)
- func (o *ORM) RawCommit() error
- func (o *ORM) RawCount(s *SQL) (count int, err error)
- func (o *ORM) RawDel(model interface{}) (sql.Result, error)
- func (o *ORM) RawDelete(s *SQL, model interface{}) (sql.Result, error)
- func (o *ORM) RawExec(query string, args ...interface{}) (sql.Result, error)
- func (o *ORM) RawForeignKey(sources interface{}, fk_column string, models interface{}, pk_column string, ...) error
- func (o *ORM) RawGet(model interface{}, columns ...string) (bool, error)
- func (o *ORM) RawGetBy(model interface{}, cols_nil_columns ...string) (bool, error)
- func (o *ORM) RawInsert(model interface{}, columns ...string) (sql.Result, error)
- func (o *ORM) RawQuery(query string, args ...interface{}) (*sql.Rows, error)
- func (o *ORM) RawQueryRow(query string, args ...interface{}) (*sql.Row, error)
- func (o *ORM) RawReplace(model interface{}, columns ...string) (sql.Result, error)
- func (o *ORM) RawRollback() error
- func (o *ORM) RawSave(model interface{}, columns ...string) (sql.Result, error)
- func (o *ORM) RawSelect(s *SQL, model interface{}, columns ...string) (bool, error)
- func (o *ORM) RawSelectVal(s *SQL, vals ...interface{}) (bool, error)
- func (o *ORM) RawUp(model interface{}, columns ...string) (sql.Result, error)
- func (o *ORM) RawUpdate(s *SQL, model interface{}, columns ...string) (sql.Result, error)
- func (o *ORM) Replace(model interface{}, columns ...string) sql.Result
- func (o *ORM) Rollback()
- func (o *ORM) Save(model interface{}, columns ...string) sql.Result
- func (o *ORM) Select(s *SQL, model interface{}, columns ...string) bool
- func (o *ORM) SelectVal(s *SQL, vals ...interface{}) bool
- func (o *ORM) SetDB(db *sql.DB)
- func (o *ORM) SetPrefix(prefix string)
- func (o *ORM) Up(model interface{}, columns ...string) sql.Result
- func (o *ORM) Update(s *SQL, model interface{}, columns ...string) sql.Result
- type SQL
- func (s *SQL) CalcFoundRows() *SQL
- func (s *SQL) Columns(columns ...string) *SQL
- func (s *SQL) Count() int
- func (s *SQL) Delete(model interface{}) sql.Result
- func (s *SQL) ForUpdate() *SQL
- func (s *SQL) From(table string) *SQL
- func (s *SQL) Group(groups ...string) *SQL
- func (s *SQL) Having(having string, args ...interface{}) *SQL
- func (s *SQL) Incr(col string, val int) *SQL
- func (s *SQL) Join(table, cond string) *SQL
- func (s *SQL) Keywords(keywords ...string) *SQL
- func (s *SQL) Limit(limit int) *SQL
- func (s *SQL) LockInShareMode() *SQL
- func (s *SQL) NewCount() *SQL
- func (s *SQL) Offset(offset int) *SQL
- func (s *SQL) Order(orders ...string) *SQL
- func (s *SQL) Page(page, pagesize int) *SQL
- func (s *SQL) Plus(col string, val int) *SQL
- func (s *SQL) RawCount() (int, error)
- func (s *SQL) RawDelete(model interface{}) (sql.Result, error)
- func (s *SQL) RawSelect(model interface{}, columns ...string) (bool, error)
- func (s *SQL) RawSelectVal(vals ...interface{}) (bool, error)
- func (s *SQL) RawUpdate(model interface{}, columns ...string) (sql.Result, error)
- func (s *SQL) Reset() *SQL
- func (s *SQL) Select(model interface{}, columns ...string) bool
- func (s *SQL) SelectCount(model interface{}, columns ...string) (bool, int)
- func (s *SQL) SelectVal(vals ...interface{}) bool
- func (s *SQL) Set(col string, val interface{}) *SQL
- func (s *SQL) SetMap(data map[string]interface{}) *SQL
- func (s *SQL) ToDelete() (string, []interface{})
- func (s *SQL) ToInsert() (string, []interface{})
- func (s *SQL) ToReplace() (string, []interface{})
- func (s *SQL) ToSelect() (string, []interface{})
- func (s *SQL) ToUpdate() (string, []interface{})
- func (s *SQL) Update(model interface{}, columns ...string) sql.Result
- func (s *SQL) Where(where string, args ...interface{}) *SQL
- func (s *SQL) WhereIn(where string, args ...interface{}) *SQL
Constants ¶
This section is empty.
Variables ¶
View Source
var Column2Field map[string]string = map[string]string{"id": "ID", "ip": "IP"}
Functions ¶
func BatchInsert ¶
func BatchInsert(models interface{}, columns ...string)
func BatchReplace ¶
func BatchReplace(models interface{}, columns ...string)
func ForeignKey ¶
Types ¶
type ModelField ¶
type ModelInfo ¶
type ModelInfo struct {
Value reflect.Value
Type reflect.Type
Map bool
Slice bool
KeyPtr bool
KeyType reflect.Type
ValPtr bool
ValType reflect.Type
ModelType reflect.Type
Table string
PK *ModelField
Columns []*ModelField
Fields []*ModelField
Column2Field map[string]*ModelField
Field2Column map[string]*ModelField
ColumnNames []string
FieldNames []string
FieldsCreated []string
FieldsUpdated []string
}
func NewModelInfo ¶
func (*ModelInfo) Column ¶
func (mi *ModelInfo) Column(field string) *ModelField
func (*ModelInfo) Field ¶
func (mi *ModelInfo) Field(column string) *ModelField
type ModelInfoManager ¶
type ModelInfoManager struct {
// contains filtered or unexported fields
}
var DefaultModelInfoManager *ModelInfoManager = NewModelInfoManager()
func NewModelInfoManager ¶
func NewModelInfoManager() *ModelInfoManager
func (*ModelInfoManager) Set ¶
func (m *ModelInfoManager) Set(mi *ModelInfo)
func (*ModelInfoManager) SetPrefix ¶
func (m *ModelInfoManager) SetPrefix(prefix string)
func (*ModelInfoManager) TableOf ¶
func (m *ModelInfoManager) TableOf(table string) *ModelInfo
type ORM ¶
type ORM struct {
BatchRow int
// contains filtered or unexported fields
}
func (*ORM) BatchInsert ¶
func (*ORM) BatchReplace ¶
func (*ORM) ForeignKey ¶
func (*ORM) Manager ¶
func (o *ORM) Manager() *ModelInfoManager
func (*ORM) NewManager ¶
func (o *ORM) NewManager()
func (*ORM) RawBatchInsert ¶
func (*ORM) RawBatchReplace ¶
func (*ORM) RawForeignKey ¶
func (*ORM) RawQueryRow ¶
func (*ORM) RawReplace ¶
func (*ORM) RawRollback ¶
type SQL ¶
type SQL struct {
// contains filtered or unexported fields
}
func (*SQL) CalcFoundRows ¶
func (*SQL) LockInShareMode ¶
func (*SQL) RawSelectVal ¶
func (*SQL) SelectCount ¶
Click to show internal directories.
Click to hide internal directories.