models

package
v0.0.0-...-b824be3 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2015 License: GPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Privatekey = `` /* 1674-byte string literal not displayed */

	Tokenduration = 24
)

Variables

This section is empty.

Functions

func AddUser

func AddUser(u *User, c appengine.Context) (*datastore.Key, error)

AddUser add a user to datastore

func CheckExist

func CheckExist(u *User, c appengine.Context) (bool, error)

CheckExist verifies that the user has not been created earlier

func DefaultAdvertiserKey

func DefaultAdvertiserKey(c appengine.Context) *datastore.Key

func DefaultUserKey

func DefaultUserKey(c appengine.Context) *datastore.Key

Return the key for use the datastore

func LoadAdvertiser

func LoadAdvertiser(a *Advertiser, c appengine.Context) (*datastore.Key, error)

Load and save the data from the advertiser on the datastore

func LoadExampleDataAtInit

func LoadExampleDataAtInit(c appengine.Context) error

This function only was need for load example data, for test the aplicacion

func ParseToken

func ParseToken(token string) (*jwt.Token, error)

Get a object token from a string hash that represent the token

Types

type Advertiser

type Advertiser struct {
	Age       int      `json:"age"`
	Id        string   `json:"id"`
	Name      string   `json:"name"`
	Sex       string   `json:"sex"`
	Nse       string   `json:"nse"`
	Coverage  string   `json:"coverage"`
	Interets  []string `json:"interests"`
	Category  string   `json:"category"`
	Budget    int      `json:"budget"`
	Objetives string   `json:"objetives"`
}

func GetAdvertisers

func GetAdvertisers(c appengine.Context) ([]Advertiser, error)

Fetch all the advertisers data from the datastore

type Token

type Token struct {
	Hash   string        `json:"token"`
	Expire time.Duration `json:"expire"`
}

func GenerateToken

func GenerateToken(user string) (Token, error)

Create and return a object Token

type User

type User struct {
	Id      int64
	Name    string `json:"name"`
	Pass    string `json:"password"`
	Email   string `json:"email"`
	Token   Token  `json:"token"`
	Created time.Time
}

func GetUser

func GetUser(email string, c appengine.Context) (User, error)

Fetch the user data from the datastore

func (*User) RefreshToken

func (u *User) RefreshToken()

Recreate the token

Jump to

Keyboard shortcuts

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