Documentation ¶
Index ¶
- Constants
- Variables
- func RollbackError(tx *Tx, originalErr error) error
- type ColumnMap
- type Connection
- func (c *Connection) Begin() (*Tx, error)
- func (c *Connection) Close() error
- func (c *Connection) Connection() *sql.DB
- func (c *Connection) DriverName() string
- func (c *Connection) Exec(query string, args ...interface{}) (Result, error)
- func (c *Connection) ExecContext(ctx context.Context, query string, args ...interface{}) (Result, error)
- func (c *Connection) Get(dest interface{}, query string, args ...interface{}) error
- func (c *Connection) GetContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error
- func (c *Connection) Query(query string, args ...interface{}) (*Rows, error)
- func (c *Connection) QueryContext(ctx context.Context, query string, args ...interface{}) (*Rows, error)
- func (c *Connection) Select(dest interface{}, query string, args ...interface{}) error
- func (c *Connection) SelectContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error
- func (c *Connection) WithTx(fn func(tx *Tx) error) error
- type Migrator
- type RawTime
- type Result
- type Row
- type Rows
- type Tx
Constants ¶
View Source
const TypeMySQL = "mysql"
Variables ¶
View Source
var ErrNotExists = errors.New("cannot update a non-existing entity")
ErrNotExists is returned when a query is executed on a non-existing entity.
Functions ¶
func RollbackError ¶
RollbackError rolls back a transaction and returns the provided error with a stack trace.
Types ¶
type ColumnMap ¶
type ColumnMap map[string]interface{}
ColumnMap is a map used to map column to their values.
type Connection ¶
func New ¶
func New(driver, dataSource string, logger log.Logger) (*Connection, error)
New returns a new Connection instance.
func NewFromConnection ¶
func NewFromConnection(conn *sqlx.DB, logger log.Logger) *Connection
NewFromConnection returns a new Connection for an existing sqlx instance.
func (*Connection) Begin ¶
func (c *Connection) Begin() (*Tx, error)
func (*Connection) Close ¶
func (c *Connection) Close() error
func (*Connection) Connection ¶
func (c *Connection) Connection() *sql.DB
func (*Connection) DriverName ¶
func (c *Connection) DriverName() string
func (*Connection) Exec ¶
func (c *Connection) Exec(query string, args ...interface{}) (Result, error)
func (*Connection) ExecContext ¶
func (*Connection) Get ¶
func (c *Connection) Get(dest interface{}, query string, args ...interface{}) error
func (*Connection) GetContext ¶
func (c *Connection) GetContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error
func (*Connection) Query ¶
func (c *Connection) Query(query string, args ...interface{}) (*Rows, error)
func (*Connection) QueryContext ¶
func (*Connection) Select ¶
func (c *Connection) Select(dest interface{}, query string, args ...interface{}) error
func (*Connection) SelectContext ¶
func (c *Connection) SelectContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error
type Migrator ¶
type Migrator struct {
// contains filtered or unexported fields
}
func NewMigrator ¶
type RawTime ¶
type RawTime []byte
RawTime handles MySQL's TIME column type. @see https://github.com/go-sql-driver/mysql#timetime-support
type Tx ¶
func (*Tx) ExecContext ¶
Click to show internal directories.
Click to hide internal directories.