core

package
v0.0.0-...-a323ea2 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitPubSub

func InitPubSub(log *logger.Log) *events.EventEmitterPubSub

InitPubSub initializes the pub/sub system

func StartServer

func StartServer(server *ServerRegistry, logger logger.Log)

StartServer starts the HTTP server

Types

type AppConfig

type AppConfig struct {
	AppName     string
	Environment string
	StartedAt   time.Time
	Swagger     SwaggerConfig
	HTTP        ServerConfig
	Database    DatabaseConfig
	Encryption  EncryptionConfig
}

AppConfig holds the configuration values

func LoadConfig

func LoadConfig(logger *logger.Log) *AppConfig

LoadConfig initializes and loads the application configuration

type DatabaseConfig

type DatabaseConfig struct {
	Database string
	Host     string
	Username string
	Password string
	Port     int
}

DatabaseConfig holds PostgreSQL connection details

type DatabaseProvider

type DatabaseProvider interface {
	GetDB() *gorm.DB
}

DatabaseProvider defines the interface for database access

type DatabaseRegistry

type DatabaseRegistry struct {
	DB *gorm.DB
}

DatabaseRegistry holds the database connection instance

func NewDatabase

func NewDatabase(config DatabaseConfig, logger logger.Log) (*DatabaseRegistry, func(), error)

NewDatabase initializes a new PostgreSQL connection using GORM

func (*DatabaseRegistry) GetDB

func (d *DatabaseRegistry) GetDB() *gorm.DB

type EncryptionConfig

type EncryptionConfig struct {
	JWTKey   string
	HashSalt string
}

type ServerConfig

type ServerConfig struct {
	Host string
	Port int
	Cors bool
}

ServerConfig holds the configuration for the server

type ServerRegistry

type ServerRegistry struct {
	HttpServer *http.Server
	RootRouter *mux.Router
	ApiRouter  *mux.Router
	AuthRouter *mux.Router
	Started    chan struct{} // <- add this
}

ServerRegistry holds the server components

func NewServer

func NewServer(config AppConfig, container *dig.Container, logger logger.Log) (*ServerRegistry, func())

NewServer initializes and returns the HTTP server

type SwaggerConfig

type SwaggerConfig struct {
	Title       string
	Version     string
	BasePath    string
	DocEndpoint string
}

SwaggerConfig holds Swagger documentation configurations

Directories

Path Synopsis
lib
env
events
Updated pubsub.go with channel-based async dispatcher
Updated pubsub.go with channel-based async dispatcher

Jump to

Keyboard shortcuts

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