database

package
v0.1.15 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDatabaseAhead            = errors.New("database is ahead of current migration, please update the application")
	ErrDatabaseNotUpToDate      = errors.New("database is not up to date, please run migrations")
	ErrNicknameEmpty            = errors.New("nickname is required")
	ErrEmailEmpty               = errors.New("email is required")
	ErrPasswordOrSSHKeyRequired = errors.New("password or ssh public key is required")
	ErrPasswordTooShort         = errors.New("password must be at least 8 characters")
	ErrInvalidCredentials       = errors.New("invalid credentials")
)

Functions

This section is empty.

Types

type Database

type Database struct {
	// contains filtered or unexported fields
}

func New

func New() (*Database, error)

func (*Database) CheckAndReturnUser added in v0.1.12

func (d *Database) CheckAndReturnUser(nickname, password string) (User, error)

func (*Database) ChkMigration added in v0.1.8

func (d *Database) ChkMigration() error

func (*Database) Close

func (d *Database) Close() error

func (*Database) CreateUser added in v0.1.12

func (d *Database) CreateUser(nickname, email, password, sshPublicKey, groups string) (User, error)

func (*Database) GetUserByEmail added in v0.1.12

func (d *Database) GetUserByEmail(email string) (User, error)

func (*Database) GetUserByID added in v0.1.12

func (d *Database) GetUserByID(id int) (User, error)

func (*Database) GetUserByNickname added in v0.1.12

func (d *Database) GetUserByNickname(nickname string) (User, error)

func (*Database) GetVersion

func (d *Database) GetVersion() (string, error)

func (*Database) RunMigration added in v0.1.8

func (d *Database) RunMigration() error

func (*Database) VerifyMigration added in v0.1.8

func (d *Database) VerifyMigration() (int, error)

type User

type User struct {
	ID           int    `db:"id"`
	Nickname     string `db:"nickname"`
	Email        string `db:"email"`
	Password     string `db:"password"`
	SSHPublicKey string `db:"ssh_public_key"`
	Groups       string `db:"groups"`
	CreatedAt    string `db:"created_at"`
	UpdatedAt    string `db:"updated_at"`
}

Jump to

Keyboard shortcuts

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