Documentation ¶
Index ¶
- Variables
- type Conn
- type CustomTotalQueryFn
- type ExecResult
- type Handle
- type Migrate
- type NtobReader
- type NtobfReader
- type NtotReader
- type RDbPaginationBuilder
- func (pagination *RDbPaginationBuilder) BuildSQL(sql string, args ...interface{}) *RDbPaginationSQLBuilder
- func (pagination *RDbPaginationBuilder) BuildStmt(stmtBuilder sq.SelectBuilder) *RDbPaginationStmtBuilder
- func (pagination *RDbPaginationBuilder) WithCustomTotalQueryFn(fn CustomTotalQueryFn) *RDbPaginationBuilder
- type RDbPaginationSQLBuilder
- type RDbPaginationStmtBuilder
- type RowResult
- type RowsResult
- type Runner
- type StatementBuilder
- type Tx
- type TypeConv
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrPrepare = errors.New("error preparing statement") ErrOpen = errors.New("error opening database connection") ErrQuery = errors.New("error querying from table") ErrWrite = errors.New("error writing to table") ErrBuildSQLStmt = fmt.Errorf("error building SQL statement: %w", ErrPrepare) ErrTypeConv = fmt.Errorf("error converting between types: %w", ErrPrepare) // when trying to scan a null row ErrNoRows = errors.New("no rows in result set") )
Functions ¶
This section is empty.
Types ¶
type CustomTotalQueryFn ¶
type CustomTotalQueryFn = func(conn *Handle, originalSelectBuilder sq.SelectBuilder) (int64, error)
type ExecResult ¶
type Handle ¶
type Handle struct { Runner TypeConv StmtBuilder *StatementBuilder }
type Migrate ¶
type Migrate interface { // Up() looks at the currently active migration version and migrate all the // way up. Up() error MustUp() // Down() looks at the currently active migration version and migrate all // the way down. Down() error MustDown() // Reset() deletes everything in the database (including migration // histories). Reset() error MustReset() // Version() returns the current active migration version and whether the // database is at dirty state Version() (version uint, dirty bool, err error) }
type NtobReader ¶
type NtobfReader ¶
type NtotReader ¶
type RDbPaginationBuilder ¶
type RDbPaginationBuilder struct { *pagination_interface.Pagination // contains filtered or unexported fields }
RDbPaginationBuilder builds pagination query based on the pagination data. It supports both SQL and StmtBuilder
func NewRDbPaginationBuilder ¶
func NewRDbPaginationBuilder(pagination *pagination_interface.Pagination, rdbHandle *Handle) *RDbPaginationBuilder
func (*RDbPaginationBuilder) BuildSQL ¶
func (pagination *RDbPaginationBuilder) BuildSQL(sql string, args ...interface{}) *RDbPaginationSQLBuilder
func (*RDbPaginationBuilder) BuildStmt ¶
func (pagination *RDbPaginationBuilder) BuildStmt(stmtBuilder sq.SelectBuilder) *RDbPaginationStmtBuilder
func (*RDbPaginationBuilder) WithCustomTotalQueryFn ¶
func (pagination *RDbPaginationBuilder) WithCustomTotalQueryFn(fn CustomTotalQueryFn) *RDbPaginationBuilder
type RDbPaginationSQLBuilder ¶
type RDbPaginationSQLBuilder struct { *pagination_interface.Pagination // contains filtered or unexported fields }
RDbPaginationBuilder is the concrete implementation to builds the pagination for SQL query
func (*RDbPaginationSQLBuilder) Result ¶
func (pagination *RDbPaginationSQLBuilder) Result() (*pagination_interface.PaginationResult, error)
func (*RDbPaginationSQLBuilder) ToSQL ¶
func (pagination *RDbPaginationSQLBuilder) ToSQL() (string, []interface{})
type RDbPaginationStmtBuilder ¶
type RDbPaginationStmtBuilder struct { *pagination_interface.Pagination // contains filtered or unexported fields }
RDbPaginationBuilder is the concrete implementation to builds the pagination for StmtBuilder
func (*RDbPaginationStmtBuilder) Result ¶
func (pagination *RDbPaginationStmtBuilder) Result() (*pagination_interface.PaginationResult, error)
func (*RDbPaginationStmtBuilder) ToStmtBuilder ¶
func (pagination *RDbPaginationStmtBuilder) ToStmtBuilder() sq.SelectBuilder
type RowsResult ¶
type RowsResult interface { Close() Err() error ExecResult() ExecResult Next() bool // When no row was found it should return ErrNoRows Scan(dest ...interface{}) error }
type Runner ¶
type Runner interface { Exec(sql string, args ...interface{}) (ExecResult, error) Query(sql string, args ...interface{}) (RowsResult, error) QueryRow(sql string, args ...interface{}) RowResult }
Implementing Conn and Tx interface automatically fulfills Runner
type StatementBuilder ¶ added in v1.0.1
type StatementBuilder struct { sq.StatementBuilderType sq.PlaceholderFormat }
func NewStatementBuilder ¶ added in v1.0.1
func NewStatementBuilder(builder sq.StatementBuilderType, placeholderFormat sq.PlaceholderFormat) *StatementBuilder
type TypeConv ¶
type TypeConv interface { // convert big.Int to native number pointer. Return nil if big.Int is nil Bton(*big.Int) interface{} // convert big.Float to native number pointer. Return nil if big.Float is nil BFton(*big.Float) interface{} Iton(int) interface{} // native number reader and parser to big.Int NtobReader() NtobReader // native number reader and parser to big.Float NtobfReader() NtobfReader // convert time.Time to native time format pointer. Return nil if time // is nil Tton(*utctime.UTCTime) interface{} // native time reader and parser to time.Time NtotReader() NtotReader }
Click to show internal directories.
Click to hide internal directories.