stringorslice

package
v1.15.1 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2020 License: Apache-2.0 Imports: 2 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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) 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

Jump to

Keyboard shortcuts

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