models

package
v0.0.0-...-972e1d8 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2016 License: MIT Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AuthenticationHandler apikit.AuthenticationFunction = func(username, password string) apikit.User {
	for _, u := range usersDB {

		if u.Username == username && u.Password == password {
			return u
		}
	}
	return nil
}

The authentication mechanism for our RESTControllers

Functions

This section is empty.

Types

type User

type User struct {
	ID            uint64 `json:"id"`
	Username      string `json:"username"`
	FavoriteColor string `json:"favorite_color"`
	Password      string `json:"-"`
}

A model that will be provided by a RESTController

func GetUserByID

func GetUserByID(id uint64) *User

Other User-related methods and data not-specific to RESTControllers

func (*User) CanBeCreatedBy

func (u *User) CanBeCreatedBy(other apikit.User) bool

func (*User) CanBeDeletedBy

func (u *User) CanBeDeletedBy(other apikit.User) bool

func (*User) CanBeModifiedBy

func (u *User) CanBeModifiedBy(other apikit.User) bool

func (*User) CanBeViewedBy

func (u *User) CanBeViewedBy(other apikit.User) bool

Implementation of RESTObject interface

func (*User) Delete

func (u *User) Delete() error

func (*User) HasAdminPrivileges

func (u *User) HasAdminPrivileges() bool

func (*User) IsNewRecord

func (u *User) IsNewRecord() bool

func (*User) Save

func (u *User) Save() error

func (*User) UniqueID

func (u *User) UniqueID() uint64

func (*User) Validate

func (u *User) Validate(v *revel.Validation)

Jump to

Keyboard shortcuts

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