user

package
v0.0.0-...-bfa56d4 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2015 License: Apache-2.0 Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetName

func GetName() string

GetName returns the name for this router.

Types

type CreateRequest

type CreateRequest struct {
	Code string `json:"code"`
}

CreateRequest encapsulates the data sent by the client to create a user.

type ListResponse

type ListResponse struct {
	Users Users `json:"users"`
}

ListResponse convenience struct for encapsulating list responses.

type Router

type Router struct {
	Subrouter *mux.Router
	DB        *sql.DB
}

Router encapsulates the state required for handling user requests.

func NewRouter

func NewRouter(db *sql.DB, sub *mux.Router) (ur *Router)

NewRouter makes a new Router with its DB set to the argument.

func (*Router) HandleRoutes

func (ur *Router) HandleRoutes()

HandleRoutes configures the provided router to handle user requests

type User

type User struct {
	ID              int64  `json:"user_id"           sql:"user_id"`
	Email           string `json:"email"             sql:"email"`
	Name            string `json:"name"              sql:"name"`
	AccessToken     string `json:"-"                 sql:"github_access_token"`
	Scope           string `json:"-"                 sql:"github_scope"`
	GitHubID        int64  `json:"github_id"         sql:"github_id"`
	GitHubLogin     string `json:"github_login"      sql:"github_login"`
	GitHubAvatarURL string `json:"github_avatar_url" sql:"github_avatar_url"`
	GitHubHTMLURL   string `json:"github_html_url"   sql:"github_html_url"`
}

User represents all pertinent user data to this service.

func LoadByGitHubID

func LoadByGitHubID(db *sql.DB, githubID int64) (*User, error)

LoadByGitHubID loads a user by the GitHub ID

func (*User) Save

func (u *User) Save(db *sql.DB) (int64, error)

Save saves the user.

type Users

type Users []User

Users represents a slice of user objects.

func LoadAll

func LoadAll(db *sql.DB) (Users, error)

LoadAll returns all users in the database.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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