Documentation
¶
Index ¶
- func IsRecordNotFound(err error) bool
- func ListColumnsByQuery(db *DB, dbname, tableName string) ([]*sql.ColumnType, error)
- func ListDatabaseByQuery(db *DB, query string, name string, exclude []string) ([]string, error)
- func ListTableByQuery(db *DB, query string, name string, params ...interface{}) ([]string, error)
- func RegisterDriver(driver Driver)
- type DB
- func (db *DB) Delete(table string, where string, args ...interface{}) (uint64, error)
- func (db *DB) GetPaging(pageSize uint, page uint, sql string, args ...interface{}) (*PagedRows, error)
- func (db *DB) GetRow(sql string, args ...interface{}) (Record, error)
- func (db *DB) GetRows(sqlStr string, args ...interface{}) ([]Record, error)
- func (db *DB) Insert(table string, row map[string]interface{}) error
- func (db *DB) InsertGetID(table string, row map[string]interface{}) (string, error)
- func (db *DB) ListColumns(dbname, tablename string) ([]*sql.ColumnType, error)
- func (db *DB) ListDatabases() ([]string, error)
- func (db *DB) ListTables(dbname string) ([]string, error)
- func (db *DB) Scalar(sql string, args ...interface{}) (uint64, error)
- func (db *DB) Update(table string, row map[string]interface{}, where string, args ...interface{}) (uint64, error)
- type Driver
- type DriverNotImplementedError
- type Field
- type Filter
- type ListInput
- type ListOutput
- type NoDriverError
- type PagedRows
- type Pagination
- type Record
- type RecordNotFoundError
- type Resource
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsRecordNotFound ¶
func ListColumnsByQuery ¶ added in v0.3.0
func ListColumnsByQuery(db *DB, dbname, tableName string) ([]*sql.ColumnType, error)
func ListDatabaseByQuery ¶ added in v0.3.0
func ListTableByQuery ¶ added in v0.3.0
func RegisterDriver ¶ added in v0.3.0
func RegisterDriver(driver Driver)
Types ¶
type DB ¶ added in v0.2.0
func (*DB) InsertGetID ¶ added in v0.3.0
func (*DB) ListColumns ¶ added in v0.2.0
func (db *DB) ListColumns(dbname, tablename string) ([]*sql.ColumnType, error)
func (*DB) ListDatabases ¶ added in v0.2.0
type Driver ¶ added in v0.2.0
type Driver interface {
Name() string
QuoteIdentifier(string) string
Placeholder(values []interface{}) []string
ListDatabases(db *DB) ([]string, error)
ListTables(db *DB, dbname string) ([]string, error)
ListColumns(db *DB, dbname string, tablename string) ([]*sql.ColumnType, error)
ScanReceiver(t *sql.ColumnType) (interface{}, error)
}
type DriverNotImplementedError ¶ added in v0.2.0
type DriverNotImplementedError struct {
}
func (DriverNotImplementedError) Error ¶ added in v0.2.0
func (e DriverNotImplementedError) Error() string
type ListInput ¶
type ListInput struct {
Pagination Pagination `json: "pagination"`
Filter Filter `json:"filter"`
}
type ListOutput ¶
type ListOutput struct {
Pagination
List []Record `json:"list"`
}
type NoDriverError ¶ added in v0.2.0
type NoDriverError struct {
}
func (NoDriverError) Error ¶ added in v0.2.0
func (e NoDriverError) Error() string
type PagedRows ¶
type PagedRows struct {
Pagination
List []Record `json:"list"`
}
type Pagination ¶
type Pagination struct {
PageSize uint `json:"page_size"`
Page uint `json:"page"`
PageTotal uint `json:"page_total"`
Total uint `json:"total"`
}
func NewPagination ¶
func NewPagination(pageSize, page uint) *Pagination
func (*Pagination) GetOffsetLimit ¶
func (p *Pagination) GetOffsetLimit() (uint, uint)
func (*Pagination) SetTotal ¶
func (p *Pagination) SetTotal(total uint)
func (*Pagination) Valid ¶
func (p *Pagination) Valid()
type RecordNotFoundError ¶
type RecordNotFoundError struct {
}
func (RecordNotFoundError) Error ¶
func (e RecordNotFoundError) Error() string
Source Files
¶
Click to show internal directories.
Click to hide internal directories.