usr

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package usr has the User type and associated methods to create, modify and delete application users

Index

Constants

This section is empty.

Variables

View Source
var ErrNoUser = errors.Str("User does not exist")

ErrNoUser is an error when a user is passed that does not exist in the db

Functions

This section is empty.

Types

type User

type User struct {
	Username  string
	Password  string
	MobileID  string
	Email     string
	FirstName string
	LastName  string
	audit.Audit
}

User represents an application user. A user can access multiple systems. The User-Application relationship is kept elsewhere...

func UserFromUsername

func UserFromUsername(ctx context.Context, log zerolog.Logger, tx *sql.Tx, username string) (*User, error)

UserFromUsername constructs a User given a username

func (*User) Create

func (u *User) Create(ctx context.Context, log zerolog.Logger) error

Create performs business validations prior to writing to the db

func (*User) CreateDB

func (u *User) CreateDB(ctx context.Context, log zerolog.Logger, tx *sql.Tx) error

CreateDB creates a record in the appuser table using a stored function

Jump to

Keyboard shortcuts

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