Documentation ¶
Overview ¶
Package user is dedicated to reading and writing user data in Auth-Db. The User and AuthCredentials resource definitions and methods are below.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrorEmailParameterInvalid = errors.New("User.email must be a valid email address.") ErrorUserIDParameterInvalid = errors.New("AuthCredentials.userID must be a valid userID.") ErrorPasswordParameterInvalid = errors.New("AuthCredentials.password must be a valid password.") ErrorUserRowNotCreated = errors.New("Create failed to create one row in the user.Users table.") )
View Source
var ( EmailMinLength = 10 EmailMaxLength = 128 ErrorEmailShort = errors.New("Email too short.") ErrorEmailLong = errors.New("Email too long.") )
View Source
var ( UserIDMinLength = 8 UserIDMaxLength = 64 ErrorUserIDShort = errors.New("UserID too short.") ErrorUserIDLong = errors.New("UserID too long.") ErrorUserIDInvalidRunes = errors.New("UserID may only consist of numbers and letters.") )
View Source
var ( PasswordMinLength = 8 PasswordMaxLength = 64 ErrorPasswordShort = errors.New("Password too short.") ErrorPasswordLong = errors.New("Password too long.") ErrorPasswordLowerCase = errors.New("Password does not contain a lowercase letter.") ErrorPasswordUpperCase = errors.New("Password does not contain an uppercase letter.") ErrorPasswordNumber = errors.New("Password does not contain a number.") ErrorPasswordSpecChars = errors.New("Password does not contain a special character.") )
Functions ¶
func CheckEmail ¶
CheckEmail returns an error if email is invalid.
func CheckPassword ¶
CheckPassword returns an error if password is invalid.
func CheckUserID ¶
CheckUserID returns an error if userID is invalid.
Types ¶
type CreateFetcher ¶
type Creater ¶
type Creater interface {
Create(*User, sq.BaseRunner)
}
type User ¶
type User struct {
// contains filtered or unexported fields
}
User references a unique user.Users row in the Moment-Db database.
type UserClient ¶
type UserClient struct {
// contains filtered or unexported fields
}
func (*UserClient) Create ¶
func (uc *UserClient) Create(u *User, db sq.BaseRunner)
Create inserts a new row into the user.Users table in db.
func (*UserClient) Err ¶
func (uc *UserClient) Err() error
Err returns the the error status of a User instance.
func (*UserClient) Fetch ¶
func (uc *UserClient) Fetch(userID string, db sq.BaseRunner) (u *User)
Fetch selects a row from the user.Users table in db.
func (*UserClient) NewUser ¶
func (uc *UserClient) NewUser(userID, email, password string) (u *User)
NewUser is a constructor of the User struct.
Click to show internal directories.
Click to hide internal directories.