core

package module
v0.0.0-...-988442a Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2025 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCronExpressionInvalid = fmt.Errorf("invalid cron expression")
)

Functions

func InvokeListenForEvents

func InvokeListenForEvents(
	eventEmitter *EventEmitter,
)

func InvokeSetCronCommand

func InvokeSetCronCommand(
	logger *slog.Logger,
	crontab *CronTab,
	command *Command,
)

func InvokeSetServerCommand

func InvokeSetServerCommand(
	logger *slog.Logger,
	server *Server,
	command *Command,
)

func InvokeSetWorkerCommand

func InvokeSetWorkerCommand(
	logger *slog.Logger,
	eventEmitter *EventEmitter,
	command *Command,
)

func LoadEnv

func LoadEnv(envFile string)

func ValidateEnvironmentVariables

func ValidateEnvironmentVariables[T interface{}]() *T

Types

type App

type App struct {
	Providers []any
	Invokers  []any
	// contains filtered or unexported fields
}

func NewApp

func NewApp() *App

func (*App) Invoke

func (c *App) Invoke() error

func (*App) Provide

func (c *App) Provide() *fx.App

func (*App) RegisterInvokers

func (c *App) RegisterInvokers(invokers ...any)

func (*App) RegisterProviders

func (c *App) RegisterProviders(providers ...any)

func (*App) Run

func (c *App) Run()

func (*App) SetUseDependencyLogger

func (c *App) SetUseDependencyLogger(useDependencyLogger bool)

type AppConfig

type AppConfig struct {
	Addr string
}

type Cleanup

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

func NewCleanup

func NewCleanup() *Cleanup

func (*Cleanup) RegisterCleanup

func (c *Cleanup) RegisterCleanup(fn func() error)

func (*Cleanup) Run

func (c *Cleanup) Run() error

type Command

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

func NewCommand

func NewCommand() *Command

func (*Command) RegisterCommand

func (c *Command) RegisterCommand(commands ...*cobra.Command)

func (*Command) Run

func (c *Command) Run() error

type CronJob

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

func NewCronJob

func NewCronJob(
	cronExpression string,
	cronFunc func() error,
) *CronJob

type CronTab

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

func NewCronTab

func NewCronTab(
	logger *slog.Logger,
) *CronTab

func (*CronTab) RegisterCronJob

func (c *CronTab) RegisterCronJob(expression string, cronFunc func() error)

func (*CronTab) Start

func (c *CronTab) Start()

type EventEmitter

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

func NewEventEmitter

func NewEventEmitter(
	logger *slog.Logger,
	pubSubContainer pubsub.Container,
) *EventEmitter

func (*EventEmitter) AddCustomOneWayHandler

func (emitter *EventEmitter) AddCustomOneWayHandler(
	handlerName string,
	subscribeTopic string,
	subscriber message.Subscriber,
	handlerFunc message.NoPublishHandlerFunc,
)

func (*EventEmitter) AddCustomTwoWayHandler

func (emitter *EventEmitter) AddCustomTwoWayHandler(
	handlerName string,
	subscribeTopic string,
	subscriber message.Subscriber,
	publishTopic string,
	publisher message.Publisher,
	handlerFunc message.HandlerFunc,
)

func (*EventEmitter) AddMiddleware

func (emitter *EventEmitter) AddMiddleware(m ...message.HandlerMiddleware)

func (*EventEmitter) AddOneWayHandler

func (emitter *EventEmitter) AddOneWayHandler(handlerName, topic string, handler message.NoPublishHandlerFunc)

func (*EventEmitter) AddTwoWayHandler

func (emitter *EventEmitter) AddTwoWayHandler(handlerName, topicSubscription, topicPublisher string, handler message.HandlerFunc)

func (*EventEmitter) Emit

func (emitter *EventEmitter) Emit(topic string, payload []byte) error

func (*EventEmitter) ListenForEvents

func (emitter *EventEmitter) ListenForEvents()

func (*EventEmitter) Run

func (emitter *EventEmitter) Run()

type Server

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

func NewServer

func NewServer(
	serverConfig ServerConfig,
	logger *slog.Logger,
) *Server

func (*Server) HTTPServer

func (s *Server) HTTPServer() *echo.Echo

func (*Server) PrintAllRoutes

func (s *Server) PrintAllRoutes()

func (*Server) Shutdown

func (s *Server) Shutdown() error

func (*Server) StartHTTPServer

func (s *Server) StartHTTPServer() error

type ServerConfig

type ServerConfig struct {
	Addr string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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