provider

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2017 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound represents a resource not found (404)
	ErrNotFound = errors.New("not found")

	// ErrUnauthorized represents a Unauthorized (401)
	ErrUnauthorized = errors.New("unauthorized")

	// ErrEmpty is returned when input string is empty
	ErrEmpty = errors.New("empty string")
)

Functions

func MakeHTTPHandler

func MakeHTTPHandler(ctx context.Context, s Service, logger log.Logger) http.Handler

MakeHTTPHandler mounts all of the service endpoints into an http.Handler. Useful in a profilesvc server.

func MakeLoginEndpoint

func MakeLoginEndpoint(s Service) endpoint.Endpoint

MakeLoginEndpoint returns the Login endpoint on the service.

Types

type Endpoints

type Endpoints struct {
	LoginEndpoint endpoint.Endpoint
}

Endpoints is a container to hold all of our Transport routes (HTTP, RPC etc.).

func MakeServerEndpoints

func MakeServerEndpoints(s Service) Endpoints

MakeServerEndpoints creates all of the routes.

type Middleware

type Middleware func(Service) Service

Middleware describes a service (as opposed to endpoint) middleware.

func LoggingMiddleware

func LoggingMiddleware(logger log.Logger) Middleware

LoggingMiddleware wraps our service and logs stuff about our services.

type Service

type Service interface {
	Login(string, string) (*User, error)
}

Service provides operations on Users.

func NewInmemService

func NewInmemService() Service

NewInmemService gets you a shiny new UserService!

type User

type User struct {
	Name string `json:"name"`

	Type string `json:"type"`
	// contains filtered or unexported fields
}

User is a representation of a User. Dah.

type UserRepository

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

UserRepository is an in-memory user database.

func (*UserRepository) ByUsername

func (u *UserRepository) ByUsername(username string) (*User, error)

ByUsername finds a user by their username.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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