sql

package
v0.0.0-...-d5421df Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DB

func DB(ctx context.Context, cfg *config.Config) (*bun.DB, error)

func NewAccounts

func NewAccounts(db *bun.DB) service.Accounts

func SetupMigrations

func SetupMigrations(ctx context.Context) (*migrate.Migrations, error)

Types

type Account

type Account struct {
	bun.BaseModel `bun:"table:accounts,alias:acts"`

	ID        string    `bun:",unique,pk"`
	Username  string    `bun:"username,notnull"`
	Password  []byte    `bun:"password,notnull"`
	CreatedAt time.Time `bun:"created_at,notnull"`
	UpdatedAt time.Time `bun:"updated_at,notnull"`
}

func NewAccount

func NewAccount(username string, password []byte) *Account

func (*Account) BeforeAppendModel

func (r *Account) BeforeAppendModel(ctx context.Context, query bun.Query) error

func (*Account) GetCreatedAt

func (r *Account) GetCreatedAt() time.Time

func (*Account) GetUsername

func (r *Account) GetUsername() string

func (*Account) Verify

func (r *Account) Verify(password []byte) bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL