service

package
v0.0.0-...-618fe63 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlogService

type BlogService interface {
	// CRUD Posts
	CreatePost(ctx context.Context, title string, slug string, description string, text string, params []*model.Query, medias []uint64, Tags []uint64, Status model.StatusPost, token string) (message string, status string, err error)
	UpdatePost(ctx context.Context, title string, slug string, description string, text string, params []*model.Query, medias []uint64, Tags []uint64, Status model.StatusPost, token string) (message string, status string, err error)
	GetPost(ctx context.Context, must []*model.Query, should []*model.Query, not []*model.Query, filter []*model.Query, token string) (posts []model.Post, message string, status string, err error)
	DeletePost(ctx context.Context, filter []*model.Query, token string) (message string, status string, err error)

	// CRUD tags
	CreateTag(ctx context.Context, name string, token string) (message string, status string, err error)
	GetTag(ctx context.Context, filter []*model.Query, token string) (tags []*model.Tag, message string, status string, err error)
	UpdateTag(ctx context.Context, oldName, newName string, token string) (message string, status string, err error)
	DeleteTag(ctx context.Context, name string, token string) (message string, status string, err error)

	// CRUD media
	// multipart.File
	Upload(ctx context.Context, title, description, fileType string, file bytes.Buffer, token string) (message string, status string, err error)
}

BlogService describes the service.

func New

func New(middleware []Middleware) BlogService

New returns a BlogService with all of the expected middleware wired in.

func NewBasicBlogService

func NewBasicBlogService() BlogService

NewBasicBlogService returns a naive, stateless implementation of BlogService.

type Middleware

type Middleware func(BlogService) BlogService

Middleware describes a service middleware.

func LoggingMiddleware

func LoggingMiddleware(logger log.Logger) Middleware

LoggingMiddleware takes a logger as a dependency and returns a BlogService Middleware.

Jump to

Keyboard shortcuts

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