model

package
v0.0.0-...-7acbbf3 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasName

func HasName(user User) bool

func HasValidEmail

func HasValidEmail(user User) bool

Types

type Location

type Location struct {
	Longitude float64
	Latitude  float64
}

Location is a value object referencing user's default location

func NewLocation

func NewLocation() Location

func (Location) IsValid

func (l Location) IsValid() bool

func (*Location) SetCoordinates

func (l *Location) SetCoordinates(long, lat float64)

TODO: Validation of Value Object should happen during the creation only, and new changes should return a new one

type PhoneNumber

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

func NewEmptyPhoneNumber

func NewEmptyPhoneNumber() PhoneNumber

func NewPhoneNumber

func NewPhoneNumber(countryCode, areaCode, number string) PhoneNumber

TODO: Validation of value object should happen only on the creation side.

func (*PhoneNumber) AreaCode

func (p *PhoneNumber) AreaCode() string

func (*PhoneNumber) CountryCode

func (p *PhoneNumber) CountryCode() string

func (PhoneNumber) IsEqual

func (p PhoneNumber) IsEqual(p2 PhoneNumber) bool

IsEqual checks whether or not two instances of PhoneNumber value object are equal or not by comparing all elements of the value objects with each other

func (*PhoneNumber) Number

func (p *PhoneNumber) Number() string

func (*PhoneNumber) SetAreaCode

func (p *PhoneNumber) SetAreaCode(ac string)

func (*PhoneNumber) SetCountryCode

func (p *PhoneNumber) SetCountryCode(cc string)

func (*PhoneNumber) SetNumber

func (p *PhoneNumber) SetNumber(ph string)

type Token

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

func NewEmptyToken

func NewEmptyToken() Token

func NewToken

func NewToken(vt, vs string) Token

func (*Token) CompareTokenVerificationWithHash

func (t *Token) CompareTokenVerificationWithHash(h []byte) bool

CompareTokenVerificationWithHash compares the bcrypt-hashed verification token with the actual plain-text value and returns true if the match

func (*Token) CreateTokenVerificationHash

func (t *Token) CreateTokenVerificationHash() ([]byte, error)

CreateTokenVerificationHash hashes the token verification using bcrypt hash algorithm

func (*Token) IsValid

func (t *Token) IsValid() bool

func (*Token) RefreshVerificationSalt

func (t *Token) RefreshVerificationSalt()

func (*Token) RefreshVerificationToken

func (t *Token) RefreshVerificationToken()

func (*Token) SetVerificationSalt

func (t *Token) SetVerificationSalt(vs string)

func (*Token) SetVerificationToken

func (t *Token) SetVerificationToken(vt string)

func (*Token) VerificationSalt

func (t *Token) VerificationSalt() string

func (*Token) VerificationToken

func (t *Token) VerificationToken() string

type User

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

func NewEmptyUser

func NewEmptyUser() User

func NewUser

func NewUser(
	id uuid.UUID,
	firstName string,
	lastName string,
	dateOfBirth time.Time,
	email string,
	phone PhoneNumber) User

func (*User) DateOfBirth

func (u *User) DateOfBirth() time.Time

func (*User) Email

func (u *User) Email() string

func (*User) ID

func (u *User) ID() uuid.UUID

func (User) IsTheSameUserAs

func (u User) IsTheSameUserAs(u2 User) bool

func (User) IsValid

func (u User) IsValid() bool

func (*User) Name

func (u *User) Name() (string, string)

func (*User) Phone

func (u *User) Phone() PhoneNumber

func (*User) SetDateOfBirth

func (u *User) SetDateOfBirth(dob time.Time)

func (*User) SetEmail

func (u *User) SetEmail(em string)

func (*User) SetID

func (u *User) SetID(id uuid.UUID)

func (*User) SetName

func (u *User) SetName(fn, ln string)

func (*User) SetPhone

func (u *User) SetPhone(ph PhoneNumber)

Jump to

Keyboard shortcuts

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