entity

package
v0.0.0-...-47482a8 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBookAlreadyBorrowed = errors.New("Book already borrowed")

ErrBookAlreadyBorrowed cannot borrow

View Source
var ErrBookNotBorrowed = errors.New("Book not borrowed")

ErrBookNotBorrowed cannot return

View Source
var ErrCannotBeDeleted = errors.New("Cannot Be Deleted")

ErrCannotBeDeleted cannot be deleted

View Source
var ErrInvalidEntity = errors.New("Invalid entity")

ErrInvalidEntity invalid entity

View Source
var ErrNotEnoughBooks = errors.New("Not enough books")

ErrNotEnoughBooks cannot borrow

View Source
var ErrNotFound = errors.New("Not found")

ErrNotFound not found

Functions

This section is empty.

Types

type ID

type ID = uuid.UUID

ID entity ID

func NewID

func NewID() ID

NewID create a new entity ID

func StringToID

func StringToID(s string) (ID, error)

StringToID convert a string to an entity ID

type User

type User struct {
	ID        ID
	Email     string
	Password  string
	FirstName string
	LastName  string
	CreatedAt time.Time
	UpdatedAt time.Time
}

User Data

func NewUser

func NewUser(email, password, firstName, lastName string) (*User, error)

NewUser create a new user

func (*User) Validate

func (u *User) Validate() error

Validate validate data

func (*User) ValidatePassword

func (u *User) ValidatePassword(p string) error

ValidatePassword validate user password

Jump to

Keyboard shortcuts

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