...

Package config

import "github.com/letsencrypt/boulder/config"
Overview
Index

Overview ▾

Variables

ErrDurationMustBeString is returned when a non-string value is presented to be deserialized as a ConfigDuration

var ErrDurationMustBeString = errors.New("cannot JSON unmarshal something other than a string into a ConfigDuration")

type Duration

Duration is just an alias for time.Duration that allows serialization to YAML as well as JSON.

type Duration struct {
    time.Duration `validate:"required"`
}

func (Duration) MarshalJSON

func (d Duration) MarshalJSON() ([]byte, error)

MarshalJSON returns the string form of the duration, as a byte array.

func (*Duration) UnmarshalJSON

func (d *Duration) UnmarshalJSON(b []byte) error

UnmarshalJSON parses a string into a ConfigDuration using time.ParseDuration. If the input does not unmarshal as a string, then UnmarshalJSON returns ErrDurationMustBeString.

func (*Duration) UnmarshalYAML

func (d *Duration) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML uses the same format as JSON, but is called by the YAML parser (vs. the JSON parser).