user

package
v0.0.0-...-8968538 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2016 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package user manages the users for the application.

sn - https://github.com/sn

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPassword

func CheckPassword(u User, password string) bool

CheckPassword validates a password

func Delete

func Delete(id types.UUID) error

Delete deletes a user based on the user ID

func Validate

func Validate(user User) error

Validate validates a username, password, and email

A user is valid if: - the username contains only alphanumerical characters, - the password

  • is longer than 10 characters,
  • contains at least one digit,
  • contains at least one lowercase letter,
  • contains at least one uppercase letter,
  • contains at least one special character.

Types

type User

type User struct {
	ID       types.UUID
	Username string
	Password string
	Address  *mail.Address
	Created  time.Time
	Updated  time.Time
}

User represents a user

func Create

func Create(user User) User

Create adds a user to the users list

func FindByAddress

func FindByAddress(address *mail.Address) User

FindByAddress finds a user by address

func FindByID

func FindByID(id types.UUID) User

FindByID looks for a user given a UUID

func FindByUsername

func FindByUsername(username string) User

FindByUsername finds a user by username

func GetAll

func GetAll() []User

GetAll returns all users

func Patch

func Patch(user User) User

Patch patches a user in the users list based on the user ID

func Update

func Update(user User) User

Update updates a user in the users list based on the user ID

Jump to

Keyboard shortcuts

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