service

package
v0.2.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GrpcRouter

type GrpcRouter struct {
	// contains filtered or unexported fields
}

GrpcRouter represents the gRPC router.

func NewGrpcRouter

func NewGrpcRouter(s Service, serviceName string) GrpcRouter

NewGrpcRouter creates a new gRPC router.

func (GrpcRouter) Start

func (g GrpcRouter) Start(port string) error

type QuoteService added in v0.2.0

type QuoteService struct {
	Service Service
	Name    string
	Port    string
	mhttp.MoshaHttpService
}

func (*QuoteService) GetName added in v0.2.0

func (qs *QuoteService) GetName() string

func (*QuoteService) GetPort added in v0.2.0

func (qs *QuoteService) GetPort() string

func (*QuoteService) MakeHandler added in v0.2.0

func (qs *QuoteService) MakeHandler() http.Handler

type Service

type Service interface {
	// CreateQuote registers a new Quote in the database.
	CreateQuote(quote data.Quote) (string, error)

	// ListAll returns all quotes in the database.
	ListAll() []data.Quote

	// UpdateQuote updates a quote in the database.
	UpdateQuote(quote data.Quote) (data.Quote, error)

	// DeleteQuote deletes a quote from the database.
	DeleteQuote(id string) error

	// GetQuote returns a quote from the database.
	GetQuote(id string) (data.Quote, error)

	// GetAuthorQuotes returns all quotes from an author.
	GetAuthorQuotes(authorID string) []data.Quote

	// DeleteAuthorQuotes deletes all quotes from an author.
	DeleteAuthorQuotes(authorID string) error

	// GetRandomQuote returns a random quote from the database.
	GetRandomQuote() (data.Quote, error)
}

Service represents the service interface.

func New

func New(repo repository.Repository) Service

Jump to

Keyboard shortcuts

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