api

package
v0.0.0-...-246ced0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MapStorage

type MapStorage struct {
	// contains filtered or unexported fields
}

func NewMapStorage

func NewMapStorage() *MapStorage

func (*MapStorage) AddUser

func (ms *MapStorage) AddUser(user User) (User, error)

func (*MapStorage) DeleteUser

func (ms *MapStorage) DeleteUser(id string) error

func (*MapStorage) GetUser

func (ms *MapStorage) GetUser(id string) (User, error)

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(addr string, storage UserStorage) *Server

func (*Server) Start

func (s *Server) Start() error

type SliceStorage

type SliceStorage struct {
	// contains filtered or unexported fields
}

func NewSliceStorage

func NewSliceStorage() *SliceStorage

func (*SliceStorage) AddUser

func (ss *SliceStorage) AddUser(user User) (User, error)

func (*SliceStorage) DeleteUser

func (ss *SliceStorage) DeleteUser(id string) error

func (*SliceStorage) GetUser

func (ss *SliceStorage) GetUser(id string) (User, error)

type User

type User struct {
	ID   string
	Name string
}

type UserStorage

type UserStorage interface {
	AddUser(User) (User, error)
	GetUser(id string) (User, error)
	DeleteUser(id string) error
}

Jump to

Keyboard shortcuts

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