usercred

package
v0.0.0-...-e3cadf0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUserNotFound = fmt.Errorf("user not found")

Functions

This section is empty.

Types

type UserCredentials

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

UserCredentials is a struct that represents database.

func New

func New(conn *db.PSQLDatabase) *UserCredentials

New returns new database.

func (*UserCredentials) GetAllIds

func (d *UserCredentials) GetAllIds(ctx context.Context) ([]int, error)

func (*UserCredentials) GetSaltAndHash

func (d *UserCredentials) GetSaltAndHash(ctx context.Context, username string) (salt, hash string, err error)

GetSaltAndHash returns salt and hash for the given username.

func (*UserCredentials) GetUserID

func (d *UserCredentials) GetUserID(ctx context.Context, username string) (int64, error)

GetUserID returns user id for the given username.

func (*UserCredentials) GetUserInfo

func (d *UserCredentials) GetUserInfo(ctx context.Context, userId int) (string, string, error)

GetUserInfo returns username, email and error by given userId.

func (*UserCredentials) HasEmailOrUsername

func (d *UserCredentials) HasEmailOrUsername(ctx context.Context, username, email string) (bool, error)

HasEmailOrUsername checks whether a user with the given username or email exists.

func (*UserCredentials) ImportGoldenWords

func (d *UserCredentials) ImportGoldenWords(ctx context.Context, userId int) error

func (*UserCredentials) ImportGoldenWordsForOld

func (d *UserCredentials) ImportGoldenWordsForOld(ctx context.Context) error

func (*UserCredentials) InsertUser

func (d *UserCredentials) InsertUser(ctx context.Context, username, salt, hash, email string) (int, error)

InsertUser inserts a new user into the database.

Jump to

Keyboard shortcuts

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