Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type StringOrSlice ¶
type StringOrSlice struct {
// contains filtered or unexported fields
}
StringOrSlice is a type that holds a []string, but marshals to a []string or a string.
func Of ¶
func Of(v ...string) StringOrSlice
Of will build a value that marshals to a JSON array if len(v) > 1, otherwise to a single string
func Slice ¶
func Slice(v []string) StringOrSlice
Slice will build a value that marshals to a JSON array
func String ¶
func String(v string) StringOrSlice
String will build a value that marshals to a single string
func (StringOrSlice) Equal ¶
func (l StringOrSlice) Equal(r StringOrSlice) bool
func (*StringOrSlice) IsEmpty ¶ added in v1.19.0
func (s *StringOrSlice) IsEmpty() bool
func (StringOrSlice) MarshalJSON ¶
func (v StringOrSlice) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface.
func (StringOrSlice) String ¶
func (s StringOrSlice) String() string
String returns the string value, or the Itoa of the int value.
func (*StringOrSlice) UnmarshalJSON ¶
func (s *StringOrSlice) UnmarshalJSON(value []byte) error
UnmarshalJSON implements the json.Unmarshaller interface.
func (*StringOrSlice) Value ¶
func (v *StringOrSlice) Value() []string
Click to show internal directories.
Click to hide internal directories.