Documentation
¶
Index ¶
- Variables
- func NewConnection(ident, connString string, sqlgBuilder *sqlg.Builder) error
- func NewConnectionFromDb(ident string, db Querier, sqlgBuilder *sqlg.Builder) error
- type Connection
- func (c *Connection) Acquire(ctx context.Context) (*pgxpool.Conn, error)
- func (c *Connection) Begin(ctx context.Context) (*Connection, error)
- func (c *Connection) Commit(ctx context.Context) error
- func (c *Connection) GetDB() Querier
- func (c *Connection) GlueExec(ctx context.Context, q *sqlg.Qg) (pgconn.CommandTag, error)
- func (c *Connection) GlueExecLog(ctx context.Context, q *sqlg.Qg) (pgconn.CommandTag, error)
- func (c *Connection) GlueGet(ctx context.Context, q *sqlg.Qg, dst interface{}) error
- func (c *Connection) GlueGetLog(ctx context.Context, q *sqlg.Qg, dst interface{}) error
- func (c *Connection) GlueQueryRowScan(ctx context.Context, q *sqlg.Qg, dst ...interface{}) error
- func (c *Connection) GlueQueryRowScanLog(ctx context.Context, q *sqlg.Qg, dst ...interface{}) error
- func (c *Connection) GlueSelect(ctx context.Context, q *sqlg.Qg, dst interface{}) error
- func (c *Connection) GlueSelectLog(ctx context.Context, q *sqlg.Qg, dst interface{}) error
- func (c *Connection) Rollback(ctx context.Context) error
- type JsonB
- type List
- func (l *List) ApplyQueryOptions(q *sqlg.Qg)
- func (l List) Conn() *Connection
- func (l List) GetFilter() sqlg.Qg
- func (l List) GetParams() QueryParams
- func (l List) GetWhere() *sqlg.Qg
- func (l *List) QueryOptions(opt QueryOptions)
- func (l *List) SetConnection(conn *Connection)
- func (l *List) SetFilter(qg sqlg.Qg)
- func (l *List) SetParams(p QueryParams)
- func (l *List) SetWhere(qg *sqlg.Qg)
- type Model
- type NullBool
- type NullFloat64
- type NullInt64
- type NullString
- type NullTime
- type Querier
- type QueryFilter
- type QueryOptions
- type QueryParams
- type TxBeginer
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNoBegin = errors.New("Can't call Begin on connection") ErrNoRollback = errors.New("Can't call Rollback on connection") ErrNoCommit = errors.New("Can't call Commit on connection") )
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 ¶
Types ¶
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
func GetConnection ¶
func GetConnection(name ...string) *Connection
func (*Connection) Begin ¶
func (c *Connection) Begin(ctx context.Context) (*Connection, error)
Transaction helpers
func (*Connection) GetDB ¶
func (c *Connection) GetDB() Querier
func (*Connection) GlueExec ¶
func (c *Connection) GlueExec(ctx context.Context, q *sqlg.Qg) (pgconn.CommandTag, error)
SQL Glue Helpers
func (*Connection) GlueExecLog ¶
func (c *Connection) GlueExecLog(ctx context.Context, q *sqlg.Qg) (pgconn.CommandTag, error)
func (*Connection) GlueGetLog ¶
func (*Connection) GlueQueryRowScan ¶
func (*Connection) GlueQueryRowScanLog ¶
func (*Connection) GlueSelect ¶
func (*Connection) GlueSelectLog ¶
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) GetParams ¶
func (l List) GetParams() QueryParams
func (*List) QueryOptions ¶
func (l *List) QueryOptions(opt QueryOptions)
func (*List) SetConnection ¶
func (l *List) SetConnection(conn *Connection)
func (*List) SetParams ¶
func (l *List) SetParams(p QueryParams)
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 Querier ¶
type Querier interface { CopyFrom(ctx context.Context, tableName Identifier, columnNames []string, rowSrc CopyFromSource) (int64, error) SendBatch(ctx context.Context, b *Batch) BatchResults Exec(ctx context.Context, sql string, arguments ...any) (commandTag pgconn.CommandTag, err error) Query(ctx context.Context, sql string, args ...any) (Rows, error) QueryRow(ctx context.Context, sql string, args ...any) Row }
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)
type QueryParams ¶
type QueryParams map[string]interface{}
Click to show internal directories.
Click to hide internal directories.