Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ResolveRelativePath ¶
ResolveRelativePath resolves a relative file path or file-based DSN against baseDir.
Types ¶
type Connection ¶
type Connection struct {
Driver string
Name string
URL string
Pool PoolConfig
}
Connection represents a resolved connection configuration with driver metadata and pool limits.
func (Connection) Key ¶
func (c Connection) Key() string
Key returns the unique identifier for the connection pool (e.g. "postgres.main").
func (Connection) Reference ¶
func (c Connection) Reference() string
Reference returns the full HCL reference path (e.g. "connection.postgres.main").
type Field ¶
type Field struct {
Name string
Type string // "string", "int", "float", "bool", "any", "list(string)", etc.
Required bool
Default any // Evaluated static default or nil
Description string
Enum []any // Evaluated allowed values or nil
Format string // "email", "uuid", "date-time", etc.
Pattern string // Regex pattern or empty
MinLength *int
MaxLength *int
Min *float64
Max *float64
MinItems *int
MaxItems *int
UniqueItems bool
}
Field represents a compiled, type-safe schema field rule.
type OpenAPIConfig ¶
type OpenAPIConfig struct {
Title string
Version string
Description string
Servers []OpenAPIServer
Tags []OpenAPITag
Contact *OpenAPIContact
License *OpenAPILicense
}
OpenAPIConfig holds global OpenAPI 3.1 document header metadata.
type OpenAPIContact ¶
OpenAPIContact defines API contact details.
type OpenAPILicense ¶
OpenAPILicense defines API licensing information.
type OpenAPIServer ¶
OpenAPIServer defines a target server deployment in the OpenAPI spec.
type OpenAPITag ¶
OpenAPITag defines an operation category tag.
type Options ¶
type Options struct {
// ConfigPath is a file or directory of .hcl definitions.
ConfigPath string
// StrictTyping enforces request schema validation on all endpoints.
StrictTyping bool
// ProblemHandler formats error responses. If nil, RFC 9457 defaults are used.
ProblemHandler problem.Handler
// Logger receives operational logs. If nil, logging is discarded.
Logger *slog.Logger
}
Options defines the configuration options for the hclapi engine.
type PoolConfig ¶
type PoolConfig struct {
MaxOpenConns int
MaxIdleConns int
ConnMaxLifetime scalar.Duration
IdleTimeout scalar.Duration
Size int
}
PoolConfig defines connection pool sizing and lifecycle settings.
func DefaultPoolConfig ¶
func DefaultPoolConfig() PoolConfig
DefaultPoolConfig returns baseline production connection pool settings.
type ProblemConfig ¶
type ProblemConfig struct {
TypePrefix string
}
ProblemConfig holds global RFC 9457 Problem Details configuration.
type Server ¶
type Server struct {
Host string
Port int
ReadTimeout scalar.Duration
WriteTimeout scalar.Duration
IdleTimeout scalar.Duration
MaxBodySize scalar.ByteSize
Problem ProblemConfig
OpenAPI OpenAPIConfig
}
Server defines the resolved HTTP server configuration.
func DefaultServer ¶
func DefaultServer() Server
DefaultServer returns baseline production configuration values.
func (Server) ProblemType ¶
ProblemType returns the error URI using Problem.TypePrefix or the default URN prefix.
func (Server) WithDefaults ¶
WithDefaults returns a copy of Server with any zero values replaced by baseline defaults.