quote

package
v0.0.0-...-75767bd Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler interface {
	Routes() *mux.Router
	Create(w http.ResponseWriter, r *http.Request)
	Update(w http.ResponseWriter, r *http.Request)
	Delete(w http.ResponseWriter, r *http.Request)
	GetAll(w http.ResponseWriter, r *http.Request)
	GetById(w http.ResponseWriter, r *http.Request)
}

func NewHandler

func NewHandler(s Service) Handler

type Quote

type Quote struct {
	Id     string `json:"id" bson:"_id"`
	Author string `json:"author" bson:"author""`
	Text   string `json:"text" bson:"text""`
	BookId string `json:"book_id" bson:"book_id"`
}

func NewQuote

func NewQuote(req QuoteRequest) *Quote

type QuoteRequest

type QuoteRequest struct {
	Author string `json:"author" bson:"author"`
	Text   string `json:"text" bson:"text"`
	BookId string `json:"book_id" bson:"book_id"`
}

type Repository

type Repository interface {
	Create(ctx context.Context, q *Quote) error
	Update(ctx context.Context, q *Quote) error
	Delete(ctx context.Context, id string) error
	GetAll(ctx context.Context) ([]Quote, error)
	GetById(ctx context.Context, id string) (*Quote, error)
}

func NewMongoRepository

func NewMongoRepository(col *mongo.Collection) Repository

type Service

type Service interface {
	Create(ctx context.Context, q *Quote) error
	Update(ctx context.Context, q *Quote) error
	Delete(ctx context.Context, id string) error
	GetAll(ctx context.Context) ([]Quote, error)
	GetById(ctx context.Context, id string) (*Quote, error)
}

func NewService

func NewService(r Repository) Service

Jump to

Keyboard shortcuts

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