Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrBadRouting is returned when an expected path variable is missing. ErrBadRouting = errors.New("inconsistent mapping between route and handler (programmer error)") )
View Source
var (
ErrRequestTypeNotFound = errors.New("Request type only valid for word, sentence and paragraph")
)
Functions ¶
func MakeHttpHandler ¶
Make Http Handler
func MakeLoremLoggingEndpoint ¶
creating Lorem Ipsum Endpoint
Types ¶
type LoremResponse ¶
response
type LoremService ¶
type LoremService struct { }
Implement service with empty struct
func (LoremService) Paragraph ¶
func (LoremService) Paragraph(min, max int) string
func (LoremService) Sentence ¶
func (LoremService) Sentence(min, max int) string
func (LoremService) Word ¶
func (LoremService) Word(min, max int) string
Implement service functions
type Service ¶
type Service interface { // generate a word with at least min letters and at most max letters. Word(min, max int) string // generate a sentence with at least min words and at most max words. Sentence(min, max int) string // generate a paragraph with at least min sentences and at most max sentences. Paragraph(min, max int) string }
Define service interface
type ServiceMiddleware ¶
create type that return function. this will be needed in main.go
func LoggingMiddleware ¶
func LoggingMiddleware(logger log.Logger) ServiceMiddleware
implement function to return ServiceMiddleware
Click to show internal directories.
Click to hide internal directories.