Documentation ¶
Index ¶
- func BulkQuery[T any](ctx context.Context, tx Queryer, query string, structs []T) error
- func BulkSQL[T any](tx Queryer, sql string, structs []T) (string, []interface{}, error)
- func IsUniqueViolation(err error) bool
- func NewQueryErrorf(cause error, sql string, sqlArgs []interface{}, message string, ...) error
- func ScanAndValidateJSON(rows *sqlx.Rows, destination interface{}) error
- func ScanJSON(rows *sqlx.Rows, destination interface{}) error
- type QueryError
- type Queryer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BulkSQL ¶
BulkSQL takes a query which uses VALUES with struct bindings and rewrites it as a bulk operation. It returns the new SQL query and the args to pass to it.
func IsUniqueViolation ¶
IsUniqueViolation returns true if the given error is a violation of unique constraint
func NewQueryErrorf ¶
func ScanAndValidateJSON ¶
ScanAndValidateJSON scans a row which is JSON into a destination struct and validates it
Types ¶
type QueryError ¶
type QueryError struct {
// contains filtered or unexported fields
}
QueryError is an error type for failed SQL queries
func AsQueryError ¶
func AsQueryError(err error) *QueryError
func (*QueryError) Error ¶
func (e *QueryError) Error() string
func (*QueryError) Query ¶
func (e *QueryError) Query() (string, []interface{})
func (*QueryError) Unwrap ¶
func (e *QueryError) Unwrap() error
Click to show internal directories.
Click to hide internal directories.