domain

package
v0.0.0-...-40fc3ee Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	StreetAddressLine1 string `json:"streetAddress1" bson:"street_address_1,omitempty"`
	StreetAddressLine2 string `json:"streetAddress2" bson:"street_address_2,omitempty"`
	PostalCode         string `json:"postalCode" bson:"postal_code,omitempty"`
	Province           string `json:"province" bson:"province,omitempty"`
	Country            Country
	State              State
	City               City
}

Address is the address of a user

type City

type City struct {
	Name string `json:"name" bson:"name,omitempty"`
	Code string `json:"code" bson:"code,omitempty"`
}

City struct

type Contact

type Contact struct {
	LineNumber  string `json:"linenumber" bson:"line_number,omitempty"`
	CountryCode string `json:"countrycode" bson:"country_code,omitempty"`
	AreaCode    string `json:"areacode" bson:"areacode,omitempty"`
	Prefix      string `json:"prefix" bson:"prefix,omitempty"`
}

Contact is the data structure for storing contact information such as phone numbers (Contact)

type Country

type Country struct {
	Name string `json:"name" bson:"name,omitempty"`
	Code string `json:"code" bson:"code,omitempty"`
}

Country struct

type Language

type Language struct {
	Name string `json:"name" bson:"name,omitempty"`
	Code string `json:"code" bson:"code,omitempty"`
}

Language is the name of a user's language spoken

type Login

type Login struct {
	UserName string `json:"username"`
	Password string `json:"password"`
}

Login ...

type Register

type Register struct {
	UserName     string    `json:"username"`
	Password     string    `json:"password"`
	FirstName    string    `json:"firstname"`
	LastName     string    `json:"lastname"`
	EmailAddress string    `json:"emailAddress"`
	Gender       string    `json:"gender"`
	Status       string    `json:"status"`
	BirthDate    time.Time `json:"birthdate"`
}

Register ...

type State

type State struct {
	Name string `json:"name" bson:"name,omitempty"`
	Code string `json:"code" bson:"code,omitempty"`
}

State struct

type User

type User struct {
	ID                bson.ObjectId `json:"id" bson:"_id,omitempty"`
	Name              string        `json:"name" bson:"name,omitempty"`
	Username          string        `json:"username" bson:"username,omitempty"`
	Password          string        `json:"password" bson:"password,omitempty"`
	Firstname         string        `json:"firstname" bson:"firstname,omitempty"`
	Lastname          string        `json:"lastname" bson:"lastname,omitempty"`
	Middlename        string        `json:"middlename" bson:"middlename,omitempty"`
	Status            string        `json:"status" bson:"status,omitempty"`
	Type              string        `json:"account_type" bson:"account_type,omitempty"`
	EmailAddress      string        `json:"emailaddress" bson:"email_address,omitempty"`
	Gender            string        `json:"gender" bson:"gender,omitempty"`
	BirthDate         time.Time     `json:"birthdate" bson:"birthdate,omitempty"`
	DateJoined        time.Time     `json:"datejoined" bson:"datejoined,omitempty"`
	MobilePhoneNumber Contact       `json:"mobile_phone_number" bson:"mobile_phone_number,omitempty"`
	BillingAddress    Address       `json:"billingAddress" bson:"billing_address,omitempty"`
	MailingAddress    Address       `json:"mailingAddress" bson:"mailing_address,omitempty"`
	Languages         []Language    `json:"languages" bson:"languages,omitempty"`
}

User is a user object that has datatypes for the user domain (User)

func NewUser

func NewUser(name string, username, password, fname, lname, email string) *User

NewUser creates a new User!

func UserFromContext

func UserFromContext(ctx context.Context) (*User, bool)

UserFromContext gets user from context

func UserMustFromContext

func UserMustFromContext(ctx context.Context) *User

UserMustFromContext gets user from context. if can't make panic

func (*User) GetPassword

func (u *User) GetPassword() []byte

GetPassword ...

func (*User) IsCredentialsVerified

func (u *User) IsCredentialsVerified(password, hash string) bool

IsCredentialsVerified matches given password with user's password

func (*User) NewContext

func (u *User) NewContext(ctx context.Context) context.Context

NewContext ...

func (*User) SetPassword

func (u *User) SetPassword(p string)

SetPassword sets user's password

Jump to

Keyboard shortcuts

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