post

package
v0.0.0-...-b73611f Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterHandlers

func RegisterHandlers(r *mux.Router, db *database.DB, logger *log.Logger, authMiddleware auth.Middleware)

Types

type CreateRequest

type CreateRequest struct {
	Title string `json:"title"`
	Body  string `json:"body"`
}

func (CreateRequest) Validate

func (r CreateRequest) Validate() error

type Service

type Service interface {
	Get(id string) (entity.Post, error)
	Count() (int, error)
	Query(offset, limit int) ([]entity.Post, error)
	Create(req CreateRequest) (entity.Post, error)
	Update(id string, req UpdateRequest) (entity.Post, error)
	Delete(id string) (entity.Post, error)
	IncrementViewCount(post entity.Post) error
}

func NewService

func NewService(db *database.DB) Service

type UpdateRequest

type UpdateRequest struct {
	Title string `json:"title"`
	Body  string `json:"body"`
}

Jump to

Keyboard shortcuts

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