mcuadros / go-defaults

Go structures with default values using tags

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature: Add support for an interface for complicated defaults

Eyal-Shalev opened this issue · comments

type Defaults interface {
  Defaults(raw string) (interface{}, error)
}

example

type Duration time.Duration

func (d *Duration) Defaults(raw string) (interface{}, error) {
  return time.ParseDuration(raw)
}