models

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2017 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

DB is a sql database connection

Functions

This section is empty.

Types

type User

type User struct {
	ID        int       `json:"id" db:"id" schema:"-"`
	CreatedAt time.Time `json:"created_at" db:"created_at"`
	UpdatedAt time.Time `json:"updated_at" db:"updated_at"`
	FirstName string    `json:"first_name" db:"first_name"`
	LastName  string    `json:"last_name" db:"last_name"`
	Email     string    `json:"email" db:"email"`
}

User model stores information about a user account

func (User) FullName

func (u User) FullName() string

FullName returns the first name and last name, separated by a space

func (User) String

func (u User) String() string

String is not required by pop and may be deleted

func (*User) ValidateNew

func (u *User) ValidateNew(tx *pop.Connection) (*validate.Errors, error)

ValidateNew validates the User fields and checks whether a user has already claimed that email address

func (*User) ValidateUpdate

func (u *User) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error)

ValidateUpdate validates the User fields and confirms that the email has not been claimed by a different user

type Users

type Users []User

Users is not required by pop and may be deleted

func (Users) String

func (u Users) String() string

String is not required by pop and may be deleted

Jump to

Keyboard shortcuts

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