models

package
v0.0.0-...-20df407 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2014 License: GPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidEmail                  = errors.New(`Invalid email`)
	ErrNotFilled                     = errors.New(`Blank email`)
	ErrorProductNameNotFilled        = errors.New(`Blank product name`)
	ErrorProductImgNotFilled         = errors.New(`Blank product image`)
	ErrorProductDescriptionNotFilled = errors.New(`Blank product description`)
	ErrorProductPriceNotFilled       = errors.New(`Blank product price`)
	ErrorProductPriceUnitNotFilled   = errors.New(`Blank product price-unit`)
)
View Source
var (
	EmailRegexp = regexp.MustCompile(`^[a-z0-9._%+\-]+@[a-z0-9.\-]+\.[a-z]{2,4}$`)
)
View Source
var UserIndex = mgo.Index{
	Key:        []string{"user_email"},
	Unique:     false,
	DropDups:   false,
	Background: true,
	Sparse:     true,
}

Functions

This section is empty.

Types

type Product

type Product struct {
	//BaseModel
	Id          bson.ObjectId `json:"id" bson:"_id,omitempty"`
	Name        string        `json:"name" bson:"name"`
	Img         string        `json:"img"  bson:"img"`
	Description string        `json:"description" bson:"description"`
	Price       string        `json:"price"  bson:"price"`
	PriceUnit   string        `json:"price_unit"  bson:"price_unit"`
}

type Products

type Products []Product

type User

type User struct {
	Id    bson.ObjectId `json:"-" bson:"_id,omitempty"`
	Email string        `json:"email" bson:"email"`
	Img   string        `json:"img"  bson:"img,omitempty"`
}

func (*User) Validator

func (user *User) Validator() error

type Wish

type Wish struct {
	//BaseModel
	Id          bson.ObjectId `json:"id" bson:"_id,omitempty"`
	Product     bson.ObjectId `json:"product_id" bson:"product_id"`
	UserEmail   string        `json:"-" bson:"user_email"`
	Name        string        `json:"name" bson:"name"`
	Img         string        `json:"img"  bson:"img"`
	Description string        `json:"description" bson:"description"`
	Price       string        `json:"price"  bson:"price"`
	PriceUnit   string        `json:"price_unit"  bson:"price_unit"`
	Timestamp   time.Time     `json:"creation_time"  bson:"creation_time,omitempty"`
}

func (*Wish) Validator

func (wish *Wish) Validator() error

type Wishes

type Wishes []Wish

Jump to

Keyboard shortcuts

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