Documentation
¶
Index ¶
- type BaseController
- func (c *BaseController) CloseLogs(ctx context.Context) error
- func (c *BaseController) LoadEnvVarsAndConfig(envVarsOutput, configOutput any, configOpts ...configurator.Option) error
- func (c *BaseController) WithPostgres(cfg *postgres.ConnectionConfig, models []interface{}, ...) (*relational.DB, error)
- func (c *BaseController) WithPromtail(params *promtail.WithPromtailParams) error
- func (c *BaseController) WithS3(ctx context.Context, cfg *s3.Config, S3SecretKey string, ...) (*s3.Client, error)
- func (c *BaseController) WithSES(ctx context.Context, cfg *ses.Config, AWSSecretKey string) (*ses.Client, error)
- func (c *BaseController) WithSQLite(cfg *sqlite.ConnectionConfig, models []interface{}, ...) (*relational.DB, error)
- func (c *BaseController) WithZerolog(configure ...func(*zerolog.ConsoleWriter))
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseController ¶
type BaseController struct {
Environment string
// contains filtered or unexported fields
}
func (*BaseController) CloseLogs ¶ added in v1.15.0
func (c *BaseController) CloseLogs(ctx context.Context) error
CloseLogs pushes the logs still buffered for Promtail. Call it before the process exits, after the last log line worth keeping.
func (*BaseController) LoadEnvVarsAndConfig ¶
func (c *BaseController) LoadEnvVarsAndConfig(envVarsOutput, configOutput any, configOpts ...configurator.Option) error
func (*BaseController) WithPostgres ¶
func (c *BaseController) WithPostgres(cfg *postgres.ConnectionConfig, models []interface{}, options ...relational.Option) (*relational.DB, error)
func (*BaseController) WithPromtail ¶ added in v1.6.1
func (c *BaseController) WithPromtail(params *promtail.WithPromtailParams) error
func (*BaseController) WithSQLite ¶ added in v1.10.0
func (c *BaseController) WithSQLite(cfg *sqlite.ConnectionConfig, models []interface{}, options ...relational.Option) (*relational.DB, error)
WithSQLite - Opens a SQLite database and creates the schema from the model structs if it doesn't already exist.
func (*BaseController) WithZerolog ¶ added in v1.6.1
func (c *BaseController) WithZerolog(configure ...func(*zerolog.ConsoleWriter))
WithZerolog installs a zerolog.ConsoleWriter on the global logger. The default layout colors each name=value field as one span (see consoleFieldName). Each configure function then runs, in order, on the writer before it is installed, so an app can override fields such as NoColor, TimeFormat or the field formatters and own its own layout. Nil configure functions are skipped.
The default FormatFieldName opens a color span that only the default FormatFieldValue closes, so replace the two together, and likewise FormatErrFieldName and FormatErrFieldValue. Replacing only one leaves the span unclosed or prints a stray reset.
Do not replace Out: it is the Promtail writer when WithPromtail enabled it, and replacing it stops forwarding lines to Loki and skips the flush on Fatal. To wrap it, keep writing through the original w.Out.