API Reference

Complete API documentation for all Egg modules.

servicex

One-line service startup API:

go
func Run(ctx context.Context, opts ...Option) error

Options:

  • WithService(name, version)
  • WithAppConfig(cfg)
  • WithAutoMigrate(models...)
  • WithRegister(fn)

configx

Configuration management API:

go
func DefaultManager(ctx context.Context, logger log.Logger) (*Manager, error)

Methods:

  • Bind(target any) error
  • Snapshot() map[string]string
  • Watch(fn func()) error

logx

Structured logging API:

go
func New(opts ...Option) *Logger

Methods:

  • Info(msg string, kv ...any)
  • Error(err error, msg string, kv ...any)
  • With(kv ...any) *Logger

runtimex

Service lifecycle management API:

go
func Run(ctx context.Context, services []Service, opts Options) error

Features:

  • Concurrent service startup
  • Health check aggregation
  • Graceful shutdown
  • Signal handling

connectx

Connect RPC interceptor API:

go
func DefaultInterceptors(opts Options) []connect.Interceptor

Interceptors:

  • Timeout enforcement
  • Structured logging
  • Metrics collection
  • OpenTelemetry tracing
  • Error mapping

storex

Storage abstraction API:

go
func NewGORMStore(opts GORMOptions) (*GORMStore, error)

Methods:

  • GetDB() *gorm.DB
  • AutoMigrate(models...)
  • Ping(ctx context.Context) error