empty.go 502 B

123456789101112131415161718192021222324
  1. package muesli
  2. // EmptyValue is a Muesli value without contents
  3. type EmptyValue struct {
  4. }
  5. // EmptyType is the type of !nil values
  6. const EmptyType = TypeValue("Empty")
  7. // NilValue is the value of !nil in Muesli
  8. var NilValue = Value(nil)
  9. func (val EmptyValue) String() string {
  10. return "<empty>"
  11. }
  12. func (v EmptyValue) Type() TypeValue { return EmptyType }
  13. func (from EmptyValue) Convert(to interface{}) error {
  14. return NewErrorValuef("Cannot convert the empty value %v to %v", from, to)
  15. }