Documentation
¶
Index ¶
- func MountSystemEndpoints(r ports.HTTPRouter, hm *health.Handler, dm *docs.Handler)
- func NewDefaultRouter(log ports.Logger) ports.HTTPRouter
- func NewMigrator(dsn, table string, lockKey int64, allowDown bool, log ports.Logger, ...) (*migrate.Adapter, error)
- func OpenAndPingDB(ctx context.Context, dsn string, timeout time.Duration) (ports.DatabasePool, error)
- func RunDown(ctx context.Context, m *migrate.Adapter, dir string) error
- func RunUp(ctx context.Context, m *migrate.Adapter, dir string) error
- func StartServer(ctx context.Context, addr string, handler http.Handler, log ports.Logger) error
- func Status(ctx context.Context, m *migrate.Adapter, dir string) (string, error)
- func WithTimeout(parent context.Context, d time.Duration) (context.Context, context.CancelFunc)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MountSystemEndpoints ¶
MountSystemEndpoints registers health, docs, and metrics endpoints.
func NewDefaultRouter ¶
func NewDefaultRouter(log ports.Logger) ports.HTTPRouter
NewDefaultRouter constructs a router with a sensible default middleware stack.
func NewMigrator ¶
func NewMigrator(dsn, table string, lockKey int64, allowDown bool, log ports.Logger, dirs []string, embedded []fs.FS) (*migrate.Adapter, error)
NewMigrator builds a migrator with either directories or embedded FS sources.
func OpenAndPingDB ¶
func OpenAndPingDB(ctx context.Context, dsn string, timeout time.Duration) (ports.DatabasePool, error)
OpenAndPingDB opens a DB pool and verifies connectivity with a short timeout.
func StartServer ¶
StartServer runs an HTTP server and performs graceful shutdown when the context is canceled.
func WithTimeout ¶
WithTimeout derives a context with a default timeout for long-running migration ops.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.