Documentation ¶
Index ¶
- Constants
- Variables
- func C(ctx context.Context) *builder
- func DummyModifyCount(sql, countColumn string) string
- func DummyModifyOrderBy(sql string, p *OrderByInfo) string
- func DummyModifyPage(sql string, p *PageInfo) string
- func GetTotal(ctx context.Context) int64
- func MysqlModifyCount(sql, countColumn string) string
- func MysqlModifyOrderBy(sql string, p *OrderByInfo) string
- func MysqlModifyPage(sql string, p *PageInfo) string
- func OracleModifyCount(sql, countColumn string) string
- func OracleModifyOrderBy(sql string, p *OrderByInfo) string
- func OracleModifyPage(sql string, p *PageInfo) string
- func OrderBy(ctx context.Context, field, order string) context.Context
- func PostgreModifyCount(sql, countColumn string) string
- func PostgreModifyOrderBy(sql string, p *OrderByInfo) string
- func PostgreModifyPage(sql string, p *PageInfo) string
- func RegisterModifier(driver string, m Modifier)
- func SqlServerModifyCount(sql, countColumn string) string
- func SqlServerModifyOrderBy(sql string, p *OrderByInfo) string
- func SqlServerModifyPage(sql string, p *PageInfo) string
- func StartPage(ctx context.Context, page, pageSize int64) context.Context
- func StartPageWithCount(ctx context.Context, page, pageSize int64, countColumn string) context.Context
- type Executor
- func (exec *Executor) Begin() error
- func (exec *Executor) Close(rollback bool)
- func (exec *Executor) Commit(require bool) error
- func (exec *Executor) Exec(ctx context.Context, sql string, params ...interface{}) (common.Result, error)
- func (exec *Executor) Query(ctx context.Context, result reflection.Object, sql string, ...) error
- func (exec *Executor) Rollback(require bool) error
- type Factory
- func (f *Factory) Close() error
- func (f *Factory) CreateExecutor(transaction transaction.Transaction) executor.Executor
- func (f *Factory) CreateSession() session.SqlSession
- func (f *Factory) CreateTransaction() transaction.Transaction
- func (f *Factory) GetDataSource() datasource.DataSource
- func (f *Factory) LogFunc() logging.LogFunc
- func (f *Factory) Open(source datasource.DataSource) error
- type IFactory
- type Modifier
- type OrderByInfo
- type PageInfo
Constants ¶
View Source
const ( DriverDummy = "default" DriverMysql = "mysql" DriverPostgre = "postgre" DriverOracle = "oracle" DriverSqlServer = "sqlserver" )
View Source
const ( ASC = "ASC" DESC = "DESC" )
Variables ¶
View Source
var DummyModifier = Modifier{ OrderBy: DummyModifyOrderBy, Page: DummyModifyPage, Count: DummyModifyCount, }
View Source
var MysqlModifier = Modifier{ OrderBy: MysqlModifyOrderBy, Page: MysqlModifyPage, Count: MysqlModifyCount, }
View Source
var OracleModifier = Modifier{ OrderBy: OracleModifyOrderBy, Page: OracleModifyPage, Count: OracleModifyCount, }
View Source
var PostgreModifier = Modifier{ OrderBy: PostgreModifyOrderBy, Page: PostgreModifyPage, Count: PostgreModifyCount, }
View Source
var SqlServerModifier = Modifier{ OrderBy: SqlServerModifyOrderBy, Page: SqlServerModifyPage, Count: SqlServerModifyCount, }
Functions ¶
func DummyModifyCount ¶
func DummyModifyOrderBy ¶
func DummyModifyOrderBy(sql string, p *OrderByInfo) string
func DummyModifyPage ¶
func MysqlModifyCount ¶
func MysqlModifyOrderBy ¶
func MysqlModifyOrderBy(sql string, p *OrderByInfo) string
func MysqlModifyPage ¶
func OracleModifyCount ¶
func OracleModifyOrderBy ¶
func OracleModifyOrderBy(sql string, p *OrderByInfo) string
func OracleModifyPage ¶
func PostgreModifyCount ¶
func PostgreModifyOrderBy ¶
func PostgreModifyOrderBy(sql string, p *OrderByInfo) string
func PostgreModifyPage ¶
func RegisterModifier ¶
func SqlServerModifyCount ¶
func SqlServerModifyOrderBy ¶
func SqlServerModifyOrderBy(sql string, p *OrderByInfo) string
func SqlServerModifyPage ¶
Types ¶
type Executor ¶
type Executor struct {
// contains filtered or unexported fields
}
type Factory ¶
type Factory struct {
// contains filtered or unexported fields
}
func (*Factory) CreateExecutor ¶
func (f *Factory) CreateExecutor(transaction transaction.Transaction) executor.Executor
func (*Factory) CreateSession ¶
func (f *Factory) CreateSession() session.SqlSession
func (*Factory) CreateTransaction ¶
func (f *Factory) CreateTransaction() transaction.Transaction
func (*Factory) GetDataSource ¶
func (f *Factory) GetDataSource() datasource.DataSource
func (*Factory) Open ¶
func (f *Factory) Open(source datasource.DataSource) error
type IFactory ¶
type IFactory struct { InitDBFunc func() error CreateTransactionFunc func() transaction.Transaction CreateExecutorFunc func(transaction.Transaction) executor.Executor CreateSessionFunc func() session.SqlSession LogFuncFunc func() logging.LogFunc }
func (*IFactory) CreateExecutor ¶
func (f *IFactory) CreateExecutor(transaction transaction.Transaction) executor.Executor
func (*IFactory) CreateSession ¶
func (f *IFactory) CreateSession() session.SqlSession
func (*IFactory) CreateTransaction ¶
func (f *IFactory) CreateTransaction() transaction.Transaction
type Modifier ¶
type Modifier struct { OrderBy func(sql string, p *OrderByInfo) string Page func(sql string, p *PageInfo) string Count func(sql, countColumn string) string }
func SelectModifier ¶
type OrderByInfo ¶
type PageInfo ¶
func GetPageInfo ¶
Click to show internal directories.
Click to hide internal directories.