Documentation ¶
Index ¶
- Constants
- Variables
- func Float64ToStr(val float64) string
- func Int32ToStr(val int32) string
- func Int64ToStr(val int64) string
- func StrToFloat64(val string) (float64, error)
- func StrToInt32(val string) (int32, error)
- func StrToInt64(val string) (int64, error)
- type AutoSql
- func (this *AutoSql) Delete(tbname string) *AutoSql
- func (this *AutoSql) Exec(args ...interface{}) (sql.Result, error)
- func (this *AutoSql) ExecInsert(args ...interface{}) (int64, error)
- func (this *AutoSql) ExecUpdateOrDel(args ...interface{}) (int64, error)
- func (this *AutoSql) From(tbname string) *AutoSql
- func (this *AutoSql) GenerateSql() string
- func (this *AutoSql) Groupby(groupBySql string) *AutoSql
- func (this *AutoSql) Having(having string) *AutoSql
- func (this *AutoSql) Insert(tbname string) *AutoSql
- func (this *AutoSql) Join(joinSql string) *AutoSql
- func (this *AutoSql) Limit(limit int) *AutoSql
- func (this *AutoSql) Orderby(OrderbySql string) *AutoSql
- func (this *AutoSql) OrmDelete(orm IEntity) (int64, error)
- func (this *AutoSql) OrmInsert(orm IEntity) (int64, error)
- func (this *AutoSql) OrmUpdate(orm IEntity) (int64, error)
- func (this *AutoSql) QueryOrm(orm IEntity, args ...interface{}) error
- func (this *AutoSql) QueryRow(args ...interface{}) (HelperRow, error)
- func (this *AutoSql) QueryRows(args ...interface{}) ([]HelperRow, error)
- func (this *AutoSql) QueryScalarInt(args ...interface{}) (int, error)
- func (this *AutoSql) QueryTable(args ...interface{}) (*HelperTable, error)
- func (this *AutoSql) Querying(args ...interface{}) (*Querying, error)
- func (this *AutoSql) Select(fieldSql string) *AutoSql
- func (this *AutoSql) Set(setSql string) *AutoSql
- func (this *AutoSql) SetRow(row *HelperRow) *AutoSql
- func (this *AutoSql) Update(tbname string) *AutoSql
- func (this *AutoSql) Where(where string) *AutoSql
- type HelperRow
- func (this HelperRow) CleverString(key string) string
- func (this HelperRow) Int(key string) (int, error)
- func (this HelperRow) Int64(key string) (int64, error)
- func (this HelperRow) PInt(key string) int
- func (this HelperRow) PInt64(key string) int64
- func (this HelperRow) PString(key string) string
- func (this HelperRow) String(key string) (string, error)
- func (this HelperRow) ToJson() (string, error)
- type HelperTable
- type IEntity
- type Querying
- type SqlHelper
- func (this *SqlHelper) Auto() *AutoSql
- func (this *SqlHelper) Begin() *SqlHelperRunner
- func (this *SqlHelper) BeginContext(ctx context.Context) *SqlHelperRunner
- func (this *SqlHelper) BeginTx(ctx context.Context, opts *sql.TxOptions) (*SqlHelperRunner, error)
- func (this *SqlHelper) Close() error
- func (this *SqlHelper) Exec(sql string, args ...interface{}) (sql.Result, error)
- func (this *SqlHelper) ExecInsert(sql string, args ...interface{}) (int64, error)
- func (this *SqlHelper) ExecUpdateOrDel(sql string, args ...interface{}) (int64, error)
- func (this *SqlHelper) Open(connectionStr string) error
- func (this *SqlHelper) OpenDebug()
- func (this *SqlHelper) QueryOrm(orm IEntity, sql string, args ...interface{}) error
- func (this *SqlHelper) QueryRow(sql string, args ...interface{}) (HelperRow, error)
- func (this *SqlHelper) QueryRows(sql string, args ...interface{}) ([]HelperRow, error)
- func (this *SqlHelper) QueryScalarInt(sql string, args ...interface{}) (int, error)
- func (this *SqlHelper) QueryTable(sql string, args ...interface{}) (*HelperTable, error)
- func (this *SqlHelper) Querying(sql string, args ...interface{}) (*Querying, error)
- func (this *SqlHelper) SetDB(conn *sql.DB)
- type SqlHelperRunner
Constants ¶
View Source
const ( SQL_SELECT = "SELECT" SQL_UPDATE = "UPDATE" SQL_DELETE = "DELETE" SQL_INSERT = "INSERT" )
View Source
const QUERY_BUFFER_SIZE = 20
Variables ¶
View Source
var NoFoundError = errors.New("no found data")
Functions ¶
Types ¶
type AutoSql ¶ added in v0.0.3
type AutoSql struct {
// contains filtered or unexported fields
}
func NewAutoSql ¶ added in v0.0.3
func (*AutoSql) ExecInsert ¶ added in v0.0.3
execute insert sql
func (*AutoSql) ExecUpdateOrDel ¶ added in v0.0.3
execute update or delete sql
func (*AutoSql) GenerateSql ¶ added in v0.0.3
func (*AutoSql) QueryScalarInt ¶ added in v0.0.3
func (*AutoSql) QueryTable ¶ added in v0.0.3
func (this *AutoSql) QueryTable(args ...interface{}) (*HelperTable, error)
type HelperTable ¶ added in v0.0.2
type HelperTable struct {
// contains filtered or unexported fields
}
func NewTable ¶ added in v0.0.2
func NewTable(rows []HelperRow, columns []string) *HelperTable
func (*HelperTable) Columns ¶ added in v0.0.2
func (this *HelperTable) Columns() []string
func (*HelperTable) Rows ¶ added in v0.0.2
func (this *HelperTable) Rows() []HelperRow
type Querying ¶
type Querying struct {
// contains filtered or unexported fields
}
func NewQuerying ¶
type SqlHelper ¶
func MysqlOpen ¶
* @todo no sql
var obj=new(tb1) con.Insert(obj) obj.setup(conn) obj.Select("id,val").Where("id=2").QueryList() sqlHelper.Select("id,val").Where("id=2").QueryList()
func (*SqlHelper) Begin ¶ added in v0.0.3
func (this *SqlHelper) Begin() *SqlHelperRunner
* begin a trasnaction
func (*SqlHelper) BeginContext ¶ added in v0.0.3
func (this *SqlHelper) BeginContext(ctx context.Context) *SqlHelperRunner
* begin context
func (*SqlHelper) ExecInsert ¶ added in v0.0.3
execute insert sql
func (*SqlHelper) ExecUpdateOrDel ¶ added in v0.0.3
execute update or delete sql
func (*SqlHelper) OpenDebug ¶ added in v0.0.3
func (this *SqlHelper) OpenDebug()
* print sql and parameter at prepare exeucting
func (*SqlHelper) QueryTable ¶ added in v0.0.2
func (this *SqlHelper) QueryTable(sql string, args ...interface{}) (*HelperTable, error)
*
read a table rows
type SqlHelperRunner ¶ added in v0.0.3
type SqlHelperRunner struct {
SqlHelper
}
func (*SqlHelperRunner) Begin ¶ added in v0.0.3
func (this *SqlHelperRunner) Begin() error
func (*SqlHelperRunner) SetContext ¶ added in v0.0.3
func (this *SqlHelperRunner) SetContext(ctx context.Context)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.