stringorset

package
v1.29.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 12, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StringOrSet

type StringOrSet struct {
	// contains filtered or unexported fields
}

StringOrSet is a type that holds a []string, but marshals to a []string or a string.

func Of

func Of(v ...string) StringOrSet

Of will build a value that marshals to a JSON array if len(v) > 1, otherwise to a single string

func Set

func Set(v []string) StringOrSet

Set will build a value that marshals to a JSON array

func String

func String(v string) StringOrSet

String will build a value that marshals to a single string

func (StringOrSet) Equal

func (l StringOrSet) Equal(r StringOrSet) bool

func (*StringOrSet) IsEmpty

func (s *StringOrSet) IsEmpty() bool

func (StringOrSet) MarshalJSON

func (v StringOrSet) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface.

func (StringOrSet) String

func (s StringOrSet) String() string

String returns the string value, or the Itoa of the int value.

func (*StringOrSet) UnmarshalJSON

func (s *StringOrSet) UnmarshalJSON(value []byte) error

UnmarshalJSON implements the json.Unmarshaller interface.

func (*StringOrSet) Value

func (v *StringOrSet) Value() []string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL