You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
packer/vendor/github.com/antihax/optional/string.go

37 lines
491 B

package optional
type String struct {
isSet bool
value string
}
func NewString(value string) String {
return String{
true,
value,
}
}
// EmptyString returns a new String that does not have a value set.
func EmptyString() String {
return String{
false,
"",
}
}
func (b String) IsSet() bool {
return b.isSet
}
func (b String) Value() string {
return b.value
}
func (b String) Default(defaultValue string) string {
if b.isSet {
return b.value
}
return defaultValue
}