Documentation ¶
Index ¶
- Variables
- func NewConnection(ident, dbtype, connString string, sqlgBuilder *sqlg.Builder) (err error)
- func NewConnectionFromDb(ident string, db *sqlx.DB, sqlgBuilder *sqlg.Builder) (err error)
- type Connection
- func (c *Connection) Begin() (*Connection, error)
- func (c *Connection) Commit() error
- func (c *Connection) GetDB() *sqlx.DB
- func (c *Connection) GetTx() *sqlx.Tx
- func (c *Connection) GlueExec(q *sqlg.Qg) error
- func (c *Connection) GlueExecLog(q *sqlg.Qg) error
- func (c *Connection) GlueGet(q *sqlg.Qg, dest interface{}) error
- func (c *Connection) GlueGetLog(q *sqlg.Qg, dest interface{}) error
- func (c *Connection) GlueQueryRowScan(q *sqlg.Qg, dest ...interface{}) error
- func (c *Connection) GlueQueryRowScanLog(q *sqlg.Qg, dest ...interface{}) error
- func (c *Connection) GlueSelect(q *sqlg.Qg, dest interface{}) error
- func (c *Connection) GlueSelectLog(q *sqlg.Qg, dest interface{}) error
- func (c *Connection) Rollback() error
- func (c *Connection) WithContext(ctx context.Context) *Connection
- type DbQuerier
- type JsonB
- type List
- type Model
- type NullBool
- type NullFloat64
- type NullInt64
- type NullString
- type NullTime
- type QueryFilter
- type QueryOptions
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrTypeAssertionArrayByte = errors.New("Type assertion .([]byte) failed.") ErrTypeAssertionMapStringInterface = errors.New("Type assertion .(map[string]interface{}) failed.") )
View Source
var ErrDbIsNil = errors.New("Database identifier is nil")
View Source
var ErrInputIsNotMap = errors.New("Input is not map type")
View Source
var (
ErrNoLimitDefined = errors.New("No limit defined")
)
Functions ¶
func NewConnection ¶
Types ¶
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
func GetConnection ¶
func GetConnection(name ...string) *Connection
func (*Connection) Commit ¶
func (c *Connection) Commit() error
func (*Connection) GetDB ¶
func (c *Connection) GetDB() *sqlx.DB
func (*Connection) GetTx ¶
func (c *Connection) GetTx() *sqlx.Tx
func (*Connection) GlueExecLog ¶
func (c *Connection) GlueExecLog(q *sqlg.Qg) error
func (*Connection) GlueGetLog ¶
func (c *Connection) GlueGetLog(q *sqlg.Qg, dest interface{}) error
func (*Connection) GlueQueryRowScan ¶
func (c *Connection) GlueQueryRowScan(q *sqlg.Qg, dest ...interface{}) error
func (*Connection) GlueQueryRowScanLog ¶
func (c *Connection) GlueQueryRowScanLog(q *sqlg.Qg, dest ...interface{}) error
func (*Connection) GlueSelect ¶
func (c *Connection) GlueSelect(q *sqlg.Qg, dest interface{}) error
func (*Connection) GlueSelectLog ¶
func (c *Connection) GlueSelectLog(q *sqlg.Qg, dest interface{}) error
func (*Connection) Rollback ¶
func (c *Connection) Rollback() error
func (*Connection) WithContext ¶
func (c *Connection) WithContext(ctx context.Context) *Connection
type DbQuerier ¶
type DbQuerier interface { Get(dest interface{}, query string, args ...interface{}) error GetContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error Exec(query string, args ...interface{}) (sql.Result, error) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error) MustExec(query string, args ...interface{}) sql.Result MustExecContext(ctx context.Context, query string, args ...interface{}) sql.Result NamedQuery(query string, arg interface{}) (*sqlx.Rows, error) Preparex(query string) (*sqlx.Stmt, error) QueryRowx(query string, args ...interface{}) *sqlx.Row QueryRowxContext(ctx context.Context, query string, args ...interface{}) *sqlx.Row Queryx(query string, args ...interface{}) (*sqlx.Rows, error) QueryxContext(ctx context.Context, query string, args ...interface{}) (*sqlx.Rows, error) Rebind(query string) string Select(dest interface{}, query string, args ...interface{}) error SelectContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error }
type List ¶
type List struct { Total int `json:"total"` Limit int `json:"limit"` Offset int `json:"offset"` // contains filtered or unexported fields }
func NewList ¶
func NewList(conn *Connection) *List
func (List) ApplyQueryOptions ¶
func (List) Conn ¶
func (l List) Conn() *Connection
func (*List) QueryOptions ¶
func (l *List) QueryOptions(opt QueryOptions)
func (*List) SetConnection ¶
func (l *List) SetConnection(conn *Connection)
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
func NewModel ¶
func NewModel(conn *Connection) *Model
func (*Model) Conn ¶
func (m *Model) Conn() *Connection
func (*Model) SetConnection ¶
func (m *Model) SetConnection(conn *Connection)
type NullBool ¶
func (NullBool) CompareHash ¶
func (NullBool) MarshalJSON ¶
func (*NullBool) UnmarshalJSON ¶
type NullFloat64 ¶
type NullFloat64 struct {
sql.NullFloat64
}
func (NullFloat64) CompareHash ¶
func (v NullFloat64) CompareHash() []byte
func (NullFloat64) MarshalJSON ¶
func (nf NullFloat64) MarshalJSON() ([]byte, error)
func (*NullFloat64) UnmarshalJSON ¶
func (nf *NullFloat64) UnmarshalJSON(b []byte) error
type NullInt64 ¶
func (NullInt64) CompareHash ¶
func (NullInt64) MarshalJSON ¶
func (*NullInt64) UnmarshalJSON ¶
type NullString ¶
type NullString struct {
sql.NullString
}
func (NullString) CompareHash ¶
func (v NullString) CompareHash() []byte
func (NullString) MarshalJSON ¶
func (ns NullString) MarshalJSON() ([]byte, error)
func (*NullString) UnmarshalJSON ¶
func (ns *NullString) UnmarshalJSON(b []byte) error
type NullTime ¶
func (NullTime) CompareHash ¶
func (NullTime) MarshalJSON ¶
func (*NullTime) UnmarshalJSON ¶
type QueryFilter ¶
type QueryFilter map[string]interface{}
func (QueryFilter) GetFromMap ¶
func (qf QueryFilter) GetFromMap(data interface{}, Allowed []string) error
func (QueryFilter) GetFromURLQuery ¶
func (qf QueryFilter) GetFromURLQuery(uq url.Values, Allowed []string) error
type QueryOptions ¶
type QueryOptions struct { Limit int Offset int Page int Sort []string SortAllow []string SortDefault string }
func (*QueryOptions) ApplyToQuery ¶
func (opt *QueryOptions) ApplyToQuery(sb *sqlg.Qg) error
func (*QueryOptions) GetFromMap ¶
func (qOpts *QueryOptions) GetFromMap(m map[string]string)
func (*QueryOptions) GetFromURLQuery ¶
func (qOpts *QueryOptions) GetFromURLQuery(m url.Values)
Click to show internal directories.
Click to hide internal directories.