lib

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2016 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateUser

func CreateUser(repo UserRepository) http.Handler

func GetUsers

func GetUsers(repo UserRepository) http.Handler

func SetUserRoutes

func SetUserRoutes() *mux.Router

Types

type InMemoryUserRepository

type InMemoryUserRepository struct {
	DataStore []User
}

func NewInMemoryUserRepo

func NewInMemoryUserRepo() *InMemoryUserRepository

func (*InMemoryUserRepository) Create

func (repo *InMemoryUserRepository) Create(user User) error

func (*InMemoryUserRepository) GetAll

func (repo *InMemoryUserRepository) GetAll() []User

func (*InMemoryUserRepository) Validate

func (repo *InMemoryUserRepository) Validate(user User) error

type User

type User struct {
	FirstName string `json:"firstname"`
	LastName  string `json:"lastname"`
	Email     string `json:email"`
}

type UserRepository

type UserRepository interface {
	GetAll() []User
	Create(User) error
	Validate(User) error
}

Jump to

Keyboard shortcuts

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