user

package
v0.0.0-...-4a6915a Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2015 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindByGoogleID

func FindByGoogleID(conn *api.DB, u *User, gid string) error

FindByGoogleID returns a user from the database by user's google ID.

func PersistUser

func PersistUser(conn *api.DB, u *User) error

PersistUser adds a new user to the database.

func RegisterContainer

func RegisterContainer(container *restful.Container, r *Resource)

RegisterContainer Defines user endpoints

func UpdateUser

func UpdateUser(conn *api.DB, u *User) error

UpdateUser updates an existing user to the database.

Types

type Resource

type Resource struct {
	*api.DB
	*api.TokenValidator
}

Resource for user handler methods.

type User

type User struct {
	ID          int64  `db:"id" json:"-"`
	GoogleID    string `db:"google_id" json:"-"`
	GoogleHash  string `db:"google_fields_hash" json:"-"`
	Name        string `db:"full_name"`
	Email       string `db:"email"`
	ShowPicture bool   `db:"show_picture"`
	Picture     string `db:"picture"`
	Alias       string `db:"alias"`
	Locale      string `db:"locale"`
	Country     string `db:"country"`
}

User User struct with db and json tags.

func Authenticate

func Authenticate(req *restful.Request, v *api.TokenValidator, conn *api.DB) (u *User, err error)

Authenticate checks a user's bearer token and returns a User. User is also persisted or updated in the database.

Jump to

Keyboard shortcuts

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