dim/types/zone.go
Gibheer 61d7ed2536 change zone type name to zonename
This should make it more obvious for what this type is intended.
2021-04-24 21:36:11 +02:00

22 lines
325 B
Go

package types
import (
"bytes"
"fmt"
)
type (
// Zone represents the name of a zone. A zone must end with a `.`.
ZoneName string
)
func (z *ZoneName) UnmarshalJSON(in []byte) error {
in = bytes.Trim(in, `"`)
if in[len(in)-1] != '.' {
return fmt.Errorf("not a valid zone name")
}
*z = ZoneName(in)
return nil
}