Documentation ¶
Index ¶
- type Database
- func (d *Database) Connect() error
- func (d *Database) CreateJob(ctx context.Context, name string, payload model.Map, timeout time.Duration) error
- func (d *Database) CreateJobForLater(ctx context.Context, name string, payload model.Map, ...) error
- func (d *Database) DeleteJob(ctx context.Context, id int) error
- func (d *Database) GetJob(ctx context.Context) (*model.Job, error)
- func (d *Database) GetUser(ctx context.Context, id model.ID) (*model.User, error)
- func (d *Database) GetUserFromToken(ctx context.Context, token string) (*model.User, error)
- func (d *Database) Login(ctx context.Context, token string) (*model.ID, error)
- func (d *Database) LoginWithEmail(ctx context.Context, email model.Email) error
- func (d *Database) MigrateDown(ctx context.Context) error
- func (d *Database) MigrateUp(ctx context.Context) error
- func (d *Database) Ping(ctx context.Context) error
- func (d *Database) Signup(ctx context.Context, u *model.User) error
- type NewDatabaseOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Database ¶
func NewDatabase ¶
func NewDatabase(opts NewDatabaseOptions) *Database
NewDatabase with the given options. If no logger is provided, logs are discarded.
func (*Database) CreateJob ¶
func (d *Database) CreateJob(ctx context.Context, name string, payload model.Map, timeout time.Duration) error
CreateJob to run immediately.
func (*Database) CreateJobForLater ¶
func (*Database) GetUserFromToken ¶
func (*Database) 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.
func (*Database) LoginWithEmail ¶
LoginWithEmail checks whether the user exists and is active, creates a login token, and creates a job to send an email with the token in it.
Click to show internal directories.
Click to hide internal directories.