Document Duration wrapper type usage
- config package doc: explain Duration fields, TOML format, env vars - duration.go: expanded godoc with access pattern examples - README: show .Duration access in quick start Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -60,6 +60,10 @@ type MyConfig struct {
|
||||
|
||||
cfg, err := config.Load[MyConfig]("my-service.toml", "MYSERVICE")
|
||||
|
||||
// Timeout fields use config.Duration (go-toml v2 doesn't decode
|
||||
// strings to time.Duration natively). Access via .Duration:
|
||||
readTimeout := cfg.Server.ReadTimeout.Duration // time.Duration
|
||||
|
||||
// Open database with standard pragmas and run migrations.
|
||||
database, err := db.Open(cfg.Database.Path)
|
||||
migrations := []db.Migration{
|
||||
|
||||
Reference in New Issue
Block a user