models

package
v0.0.0-...-6749d27 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2016 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package models contains data structures and associated behavior

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type User

type User struct {
	UserID       string        `bson:"user_id,omitempty" json:"user_id,omitempty"`
	UserType     int           `bson:"type" json:"type" validate:"required"`
	FirstName    string        `bson:"first_name" json:"first_name" validate:"required"`
	LastName     string        `bson:"last_name" json:"last_name" validate:"required"`
	Email        string        `bson:"email" json:"email" validate:"required"`
	Company      string        `bson:"company" json:"company" validate:"required"`
	Addresses    []UserAddress `bson:"addresses" json:"addresses" validate:"required"`
	DateModified *time.Time    `bson:"date_modified" json:"date_modified"`
	DateCreated  *time.Time    `bson:"date_created,omitempty" json:"date_created"`
}

User contains information about a user.

func (*User) Compare

func (u *User) Compare(ut *User) ([]app.Invalid, error)

Compare checks the fields against another User value.

func (*User) Validate

func (u *User) Validate() ([]app.Invalid, error)

Validate checks the fields to verify the value is in a proper state.

type UserAddress

type UserAddress struct {
	Type         int        `bson:"type" json:"type" validate:"required"`
	LineOne      string     `bson:"line_one" json:"line_one" validate:"required"`
	LineTwo      string     `bson:"line_two" json:"line_two,omitempty"`
	City         string     `bson:"city" json:"city" validate:"required"`
	State        string     `bson:"state" json:"state" validate:"required"`
	Zipcode      string     `bson:"zipcode" json:"zipcode" validate:"required"`
	Phone        string     `bson:"phone" json:"phone" validate:"required"`
	DateModified *time.Time `bson:"date_modified" json:"date_modified"`
	DateCreated  *time.Time `bson:"date_created,omitempty" json:"date_created"`
}

UserAddress contains information about a user's address.

func (*UserAddress) Compare

func (ua *UserAddress) Compare(uat *UserAddress) ([]app.Invalid, error)

Compare checks the fields against another UserAddress value.

func (*UserAddress) Validate

func (ua *UserAddress) Validate() ([]app.Invalid, error)

Validate checks the fields to verify the value is in a proper state.

Jump to

Keyboard shortcuts

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