Documentation ¶
Index ¶
- Constants
- func Export(v interface{}) string
- func FormatUpper(str string) string
- func Json(v interface{}) string
- func Keys(src map[string]interface{}) []string
- func ReflectFields(iface interface{}) []string
- func Substr(s string, start, length int) string
- type Adapter
- func (adapter *Adapter) Close() error
- func (adapter *Adapter) DB() *sql.DB
- func (adapter *Adapter) Debug(flag ...bool)
- func (adapter *Adapter) Exec(sql string, args ...interface{}) (int64, error)
- func (adapter *Adapter) Id(args interface{}) *Model
- func (adapter *Adapter) In(field string, values interface{}) *Model
- func (adapter *Adapter) NewModel() *Model
- func (adapter *Adapter) NotIn(field string, values interface{}) *Model
- func (adapter *Adapter) Query(sql string, args ...interface{}) ([]map[string]interface{}, error)
- func (adapter *Adapter) Scan(sour interface{}, dest interface{}) error
- func (adapter *Adapter) SetLogLevel(level int)
- func (adapter *Adapter) SetLogger(logger iLogger)
- func (adapter *Adapter) SetMaxIdleConns(n int)
- func (adapter *Adapter) SetMaxOpenConns(n int)
- func (adapter *Adapter) T(args string) *Model
- func (adapter *Adapter) Table(args string) *Model
- func (adapter *Adapter) Where(args ...interface{}) *Model
- func (adapter *Adapter) WhereIn(field string, values interface{}) *Model
- func (adapter *Adapter) WhereNotIn(field string, values interface{}) *Model
- func (adapter *Adapter) WhereRaw(args string) *Model
- type LogEntry
- func (l *LogEntry) Debug(v ...interface{})
- func (l *LogEntry) Debugf(f string, v ...interface{})
- func (l *LogEntry) Error(v ...interface{})
- func (l *LogEntry) Errorf(f string, v ...interface{})
- func (l *LogEntry) Flag() int
- func (l *LogEntry) Info(v ...interface{})
- func (l *LogEntry) Infof(f string, v ...interface{})
- func (l *LogEntry) Init()
- func (l *LogEntry) Level() int
- func (l *LogEntry) Prefix() string
- func (l *LogEntry) SetFlag(flag int)
- func (l *LogEntry) SetLevel(level int)
- func (l *LogEntry) SetPrefix(prefix string)
- func (l *LogEntry) Warn(v ...interface{})
- func (l *LogEntry) Warnf(f string, v ...interface{})
- type Model
- func (model *Model) As(args string) *Model
- func (model *Model) Begin() error
- func (model *Model) Close()
- func (model *Model) Commit() error
- func (model *Model) Count() (int64, error)
- func (model *Model) Delete() (num int64, err error)
- func (model *Model) Distinct(args string) *Model
- func (model *Model) Exec(sql string, args ...interface{}) (sql.Result, error)
- func (model *Model) Fetch() (map[string]interface{}, error)
- func (model *Model) FetchAll() ([]map[string]interface{}, error)
- func (model *Model) Fields(args ...string) *Model
- func (model *Model) Find(s interface{}) error
- func (model *Model) First(i interface{}) error
- func (model *Model) FullJoin(table, condition string) *Model
- func (model *Model) GroupBy(args string) *Model
- func (model *Model) Id(args interface{}) *Model
- func (model *Model) Init()
- func (model *Model) Insert(args interface{}) (id int64, err error)
- func (model *Model) Join(table, condition string) *Model
- func (model *Model) LeftJoin(table, condition string) *Model
- func (model *Model) Limit(args ...int) *Model
- func (model *Model) MultiInsert(args interface{}) (int64, error)
- func (model *Model) OrWhere(args ...interface{}) *Model
- func (model *Model) OrderBy(args string) *Model
- func (model *Model) Query(sql string, args ...interface{}) ([]map[string]interface{}, error)
- func (model *Model) RightJoin(table, condition string) *Model
- func (model *Model) Rollback() error
- func (model *Model) SetPk(pk string) *Model
- func (model *Model) Table(args string) *Model
- func (model *Model) Update(args interface{}) (n int64, err error)
- func (model *Model) Where(args ...interface{}) *Model
- func (model *Model) WhereIn(field string, values interface{}) *Model
- func (model *Model) WhereNotIn(field string, values interface{}) *Model
- func (model *Model) WhereRaw(args string) *Model
- type Options
- type Statement
- func (statement *Statement) As(args string) *Statement
- func (statement *Statement) CustomError(msg string, f, c int, flag ...bool)
- func (statement *Statement) Distinct(args string) *Statement
- func (statement *Statement) Error(msg string, flag ...bool)
- func (statement *Statement) Fileds(args ...string) *Statement
- func (statement *Statement) FullJoin(table, condition string) *Statement
- func (statement *Statement) GroupBy(args string) *Statement
- func (statement *Statement) Init()
- func (statement *Statement) Join(table, condition string) *Statement
- func (statement *Statement) LeftJoin(table, condition string) *Statement
- func (statement *Statement) Limit(args ...int) *Statement
- func (statement *Statement) OrWhere(args ...interface{}) *Statement
- func (statement *Statement) OrderBy(args string) *Statement
- func (statement *Statement) RightJoin(table, condition string) *Statement
- func (statement *Statement) SetPk(pk string) *Statement
- func (statement *Statement) Table(table string) *Statement
- func (statement *Statement) Trace() (file string, line int, function string)
- func (statement *Statement) Where(args ...interface{}) *Statement
- func (statement *Statement) WhereIn(field string, values interface{}) *Statement
- func (statement *Statement) WhereNotIn(field string, values interface{}) *Statement
- func (statement *Statement) WhereRaw(args string) *Statement
Constants ¶
View Source
const ( NODATA_ERROR = "no data was queried." SLICEPOINTER_ERROR = "needs a pointer to a slice." TABLENAME_ERROR = "table name cannot be empty." WHERE_ERROR = "where condition cannot be empty." PARAMETER_ERROR = "parameter error." PARAMETER_FIRST_REQUIRED = "first parameter cannot be empty." PARAMETER_SECOND_SLICE_REQUIRED = "second parameter needs a slice." )
View Source
const ( LOG_PREFIX = "[mysqldb]" LOG_FORMAT = log.LstdFlags LOG_LEVEL = LOG_DEBUG )
View Source
const ( LOG_DEBUG int = iota LOG_INFO LOG_WARN LOG_ERROR )
Variables ¶
This section is empty.
Functions ¶
func FormatUpper ¶
func ReflectFields ¶
func ReflectFields(iface interface{}) []string
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
func (*Adapter) SetLogLevel ¶
func (*Adapter) SetMaxIdleConns ¶
func (*Adapter) SetMaxOpenConns ¶
func (*Adapter) WhereNotIn ¶
type LogEntry ¶
type LogEntry struct { LogInfo *log.Logger LogWarn *log.Logger LogDebug *log.Logger LogError *log.Logger // contains filtered or unexported fields }
func InitLogger ¶
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
func (*Model) MultiInsert ¶ added in v0.1.4
func (*Model) WhereNotIn ¶
type Statement ¶
type Statement struct { TableName string // contains filtered or unexported fields }
func (*Statement) CustomError ¶
func (*Statement) WhereNotIn ¶
Click to show internal directories.
Click to hide internal directories.