usermanager

package module
v0.0.0-...-0027732 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUserExists is returned when user already exists during the
	// creation
	ErrUserExists = errors.New("User already exists")
	// ErrUserNotFound is returned when user not found in select/delete
	// query
	ErrUserNotFound = errors.New("User not found")
	// ErrPasswordDoesNotMatch is returned when the provided password is
	// wrong
	ErrPasswordDoesNotMatch = errors.New("Password doesn't match")
)

Functions

This section is empty.

Types

type User

type User struct {
	UserCredentials
	Salt string
}

User represents a database user entry

type UserCredentials

type UserCredentials struct {
	Username string
	Password string
}

UserCredentials holds username and password

type UserManager

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

UserManager provides encapsulated access to the users database

func New

func New(dbName string) *UserManager

New creates a UserManager

Also see NewWithSeed

func NewWithSeed

func NewWithSeed(dbName string, seed int64) (manager *UserManager)

NewWithSeed behaves like New, but with the provided seed for the salt generator

func (*UserManager) CheckPassword

func (manager *UserManager) CheckPassword(username, password string) error

CheckPassword checks whether the provided credentials are correct

func (*UserManager) Close

func (manager *UserManager) Close() error

Close closes database connection

Jump to

Keyboard shortcuts

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