Documentation
¶
Index ¶
- Variables
- func MakeCreateProfileEndpoint(s Service) endpoint.Endpoint
- func MakeDeleteProfileEndpoint(s Service) endpoint.Endpoint
- func MakeDieProfileEndpoint(s Service) endpoint.Endpoint
- func MakeGetProfileEndpoint(s Service) endpoint.Endpoint
- func MakeHTTPHandler(s Service, logger log.Logger) http.Handler
- func MakeQueryProfileEndpoint(s Service) endpoint.Endpoint
- type DieRequest
- type Endpoints
- type Middleware
- type Profile
- type ProfileForm
- type Query
- type Service
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNotFound = errors.New("not found") ErrAlreadyDied = errors.New("already died") ErrDuplicateName = errors.New("duplicate name") )
View Source
var ( // ErrBadRouting is returned when an expected path variable is missing. // It always indicates programmer error. ErrBadRouting = errors.New("inconsistent mapping between route and handler (programmer error)") )
Functions ¶
func MakeDieProfileEndpoint ¶
func MakeGetProfileEndpoint ¶
Types ¶
type DieRequest ¶
type DieRequest struct {
ID int `json:"id"`
}
type Endpoints ¶
type Endpoints struct {
CreateProfileEndpoint endpoint.Endpoint
GetProfileEndpoint endpoint.Endpoint
QueryProfileEndpoint endpoint.Endpoint
DieProfileEndpoint endpoint.Endpoint
DeleteProfileEndpoint endpoint.Endpoint
}
func MakeClientEndpoints ¶
func MakeServerEndpoints ¶
func (Endpoints) DeleteProfile ¶
type Middleware ¶
func LoggingMiddleware ¶
func LoggingMiddleware(logger log.Logger) Middleware
type ProfileForm ¶
type ProfileForm struct {
Name string `json:"name"`
}
type Service ¶
type Service interface {
CreateProfile(ctx context.Context, p ProfileForm) (*Profile, error)
GetProfile(ctx context.Context, id int) (*Profile, error)
QueryProfile(ctx context.Context, q Query) (*Profile, error)
DieProfile(ctx context.Context, id int) (*Profile, error)
DeleteProfile(ctx context.Context, id int) error
}
func NewInmemService ¶
func NewInmemService() Service
Click to show internal directories.
Click to hide internal directories.