github.com/tonyhb/nomad@v0.11.8/helper/fields/schema.go (about)

     1  package fields
     2  
     3  // FieldSchema is a basic schema to describe the format of a configuration field
     4  type FieldSchema struct {
     5  	Type        FieldType
     6  	Default     interface{}
     7  	Description string
     8  	Required    bool
     9  }
    10  
    11  // DefaultOrZero returns the default value if it is set, or otherwise
    12  // the zero value of the type.
    13  func (s *FieldSchema) DefaultOrZero() interface{} {
    14  	if s.Default != nil {
    15  		return s.Default
    16  	}
    17  
    18  	return s.Type.Zero()
    19  }