model

package
v0.0.0-...-db01812 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2015 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OrganizationDefault organizationType = iota
	OrganizationShelter
	OrganizationRestaurant
	OrganizationChurch
)

Variables

View Source
var (
	ErrInvalidOrganizationName        = errors.New("invalid name")
	ErrInvalidOrganizationDescription = errors.New("invalid description")
	ErrInvalidOrganizationEmail       = errors.New("invalid email")
	ErrInvalidOrganizationType        = errors.New("invalid type")
	ErrInvalidOrganizationAddress     = errors.New("invalid address")
	ErrInvalidOrganizationPassword    = errors.New("invalid password")
)
View Source
var RegexpEmail = regexp.MustCompile(`^[^@]+@[^@.]+\.[^@.]+`)

Functions

This section is empty.

Types

type Organization

type Organization struct {
	ID          int64            `json:"id"`
	Created     time.Time        `json:"created"`
	Updated     time.Time        `json:"updated"`
	Name        string           `json:"name"`
	Description string           `json:"description"`
	Email       string           `json:"email"`
	Type        organizationType `json:"type"`
	Address     string           `json:"address"`
	Location    location         `json:"location"`
	Password    string           `json:"-"`
}

func NewOrganization

func NewOrganization(jsonReader io.Reader) (*Organization, error)

func (*Organization) ComparePassword

func (o *Organization) ComparePassword(password string) error

ComparePassword compares the supplied password to the user password stored in the database.

type RequestOrganization

type RequestOrganization struct {
	Name        string           `json:"name"`
	Description string           `json:"description"`
	Email       string           `json:"email"`
	Type        organizationType `json:"type"`
	Address     string           `json:"address"`
	Password    string           `json:"password"`
}

type Token

type Token struct {
	Body string `json:"token"`
}

Token represents a JSON Web Token (JWT) as returned to the user.

func NewToken

func NewToken(org *Organization) (*Token, error)

NewToken creates a new Token from a provided user.

Jump to

Keyboard shortcuts

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