Documentation ¶
Index ¶
- func ConflictWrap(err error) error
- func CreateNamed(ctx context.Context, c Creator, m Creatable, query string) error
- func DeleteFromTable(ctx context.Context, e sqlx.ExecerContext, id uint64, table string) error
- func DynamicGet(ctx context.Context, p Preparer, baseQuery string, dq DynamicQuery, ...) error
- func DynamicSelect(ctx context.Context, p Preparer, baseQuery string, dq DynamicQuery, ...) error
- func NotFoundWrap(err error) error
- func Now() time.Time
- func WithTx(ctx context.Context, db *sqlx.DB, ...) error
- type Creatable
- type Creator
- type DynamicQuery
- type Model
- type Preparer
- type StaticError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConflictWrap ¶
ConflictWrap converts pq's unique_violation errors to ErrConflict.
func CreateNamed ¶
func DeleteFromTable ¶
func DynamicGet ¶
func DynamicSelect ¶
func NotFoundWrap ¶
NotFoundWrap converts sql.ErrNoRows to ErrNotFound.
Types ¶
type DynamicQuery ¶
type DynamicQuery struct {
// contains filtered or unexported fields
}
func (*DynamicQuery) Copy ¶
func (dq *DynamicQuery) Copy() DynamicQuery
type Model ¶
type Model struct { ID uint64 `json:"id" db:"id"` CreatedAt time.Time `json:"createdAt" db:"created_at"` UpdatedAt time.Time `json:"updatedAt" db:"updated_at"` DeletedAt *time.Time `json:"-" db:"deleted_at"` }
Model can be embedded in other structs to provide common fields.
type StaticError ¶
type StaticError string
const ( ErrNotFound StaticError = "not found" ErrConflict StaticError = "conflict" )
func (StaticError) Error ¶
func (e StaticError) Error() string
Click to show internal directories.
Click to hide internal directories.