itemsproducer

package
v0.0.0-...-8fb0787 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2023 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	AMQP     rabbitmq.Config
	Cache    redis.Config
	Database database.Database
	HTTP     api.Config
}

Config for application

func (*Config) AMQPConfig

func (c *Config) AMQPConfig() *rabbitmq.Config

AMQPConfig implements setup.AMQPConfigProvider

func (*Config) CacheConfig

func (c *Config) CacheConfig() *redis.Config

CacheConfig implements setup.CacheConfigProvider

func (*Config) DatabaseConfig

func (c *Config) DatabaseConfig() *database.Database

DatabaseConfig implements setup.DatabaseConfigProvider

func (*Config) HTTPConfig

func (c *Config) HTTPConfig() *api.Config

HTTPConfig implements setup.HTTPConfigProvider

type Handler

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

Handler ...

func NewItemsHandler

func NewItemsHandler(cmd ItemsSampleUsage) *Handler

NewItemsHandler ...

func (*Handler) AllDatabases

func (h *Handler) AllDatabases() func(w http.ResponseWriter, r *http.Request)

AllDatabases sample handler to get with all db names

func (*Handler) CreateItemHandler

func (h *Handler) CreateItemHandler() func(w http.ResponseWriter, r *http.Request)

CreateItemHandler creates new model.SampleItem

func (*Handler) GetItemHandler

func (h *Handler) GetItemHandler() func(w http.ResponseWriter, r *http.Request)

GetItemHandler render an item by id

func (*Handler) LivenessHandler

func (h *Handler) LivenessHandler() func(w http.ResponseWriter, r *http.Request)

LivenessHandler to check api response

func (*Handler) UpdateItemHandler

func (h *Handler) UpdateItemHandler() func(w http.ResponseWriter, r *http.Request)

UpdateItemHandler updates model.SampleItem

type Items

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

Items implements ItemsSampleUsage

func NewItemsDomain

func NewItemsDomain(repo *datasource.SampleDB, pbl rabbitmq.AMQPPublisher) *Items

NewItemsDomain constructor

func (*Items) AddOne

func (i *Items) AddOne(ctx context.Context, m *model.SampleItem) error

AddOne ...

func (*Items) AllDatabases

func (i *Items) AllDatabases(ctx context.Context) ([]string, error)

AllDatabases sample method to get with all db names

func (*Items) GetOne

func (i *Items) GetOne(ctx context.Context, id int) (*model.SampleItem, error)

GetOne ...

func (*Items) List

func (i *Items) List(_ context.Context) ([]*model.SampleItem, error)

List ...

func (*Items) Readiness

func (i *Items) Readiness() error

Readiness of domain

func (*Items) UpdateOne

func (i *Items) UpdateOne(ctx context.Context, m *model.SampleItem) error

UpdateOne ...

type ItemsSampleUsage

type ItemsSampleUsage interface {
	Readiness() error
	AllDatabases(ctx context.Context) ([]string, error)
	AddOne(ctx context.Context, m *model.SampleItem) error
	UpdateOne(ctx context.Context, m *model.SampleItem) error
	GetOne(ctx context.Context, id int) (*model.SampleItem, error)
	List(ctx context.Context) ([]*model.SampleItem, error)
}

ItemsSampleUsage represents sample usage of sample domain

type Server

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

Server representation

func NewServer

func NewServer(cfg *Config, env *server.Env) (*Server, error)

NewServer constructor

func (*Server) Routes

func (s *Server) Routes(_ context.Context) *chi.Mux

Routes initialization

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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