publishing

package
v0.0.0-...-5d7caa6 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeEndpointCreateArticle

func MakeEndpointCreateArticle(s Service) endpoint.Endpoint

func MakeEndpointGetArticle

func MakeEndpointGetArticle(s Service) endpoint.Endpoint

func NewService

func NewService(repo ArticlesRepository) *service

func RegisterRoutes

func RegisterRoutes(router *httprouter.Router, s Service)

Types

type ArticlesRepository

type ArticlesRepository interface {
	GetArticle(ctx context.Context, id string) (article.Article, error)
	InsertArticle(ctx context.Context, thing article.Article) error
}

type CreateArticleRequestModel

type CreateArticleRequestModel struct {
	Title string
	Text  string
}

func (CreateArticleRequestModel) ToArticle

type CreateArticleResponseModel

type CreateArticleResponseModel struct {
	ID string
}

type GetArticleRequestModel

type GetArticleRequestModel struct {
	ID string
}

type GetArticleResponseModel

type GetArticleResponseModel struct {
	Article article.Article
}

type Router

type Router interface {
	Handle(method, path string, handler http.Handler)
}

type Service

type Service interface {
	GetArticle(ctx context.Context, id string) (article.Article, error)
	CreateArticle(ctx context.Context, thing article.Article) (id string, err error)
}

Jump to

Keyboard shortcuts

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