Documentation ¶
Index ¶
- Variables
- type Helper
- func (h *Helper) Connect() error
- func (h *Helper) CreateJobInTx(ctx context.Context, tx *Tx, name string, m stringMap) error
- func (h *Helper) Exec(ctx context.Context, query string, args ...any) error
- func (h *Helper) Get(ctx context.Context, dest any, query string, args ...any) error
- func (h *Helper) GetUser(ctx context.Context, id model.ID) (model.User, error)
- func (h *Helper) InTransaction(ctx context.Context, callback func(tx *Tx) error) (err error)
- func (h *Helper) Login(ctx context.Context, token string) (model.User, error)
- func (h *Helper) MigrateDown(ctx context.Context) error
- func (h *Helper) MigrateUp(ctx context.Context) error
- func (h *Helper) Ping(ctx context.Context) error
- func (h *Helper) Select(ctx context.Context, dest any, query string, args ...any) error
- func (h *Helper) Signup(ctx context.Context, u model.User) (model.User, error)
- func (h *Helper) TryLogin(ctx context.Context, email model.Email) error
- type NewHelperOptions
- type Tx
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoRows = sql.ErrNoRows
Functions ¶
This section is empty.
Types ¶
type Helper ¶
func NewHelper ¶
func NewHelper(opts NewHelperOptions) *Helper
NewHelper with the given options. If no logger is provided, logs are discarded.
func (*Helper) CreateJobInTx ¶
func (*Helper) InTransaction ¶
InTransaction runs callback in a transaction, and makes sure to handle rollbacks, commits etc.
func (*Helper) Login ¶
Login with the given token. It marks the token as used (but this isn't currently checked anywhere) if it's not expired and if the user is marked active. It also sets the user confirmed. Returns the user.
type NewHelperOptions ¶
Click to show internal directories.
Click to hide internal directories.