strslice

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2016 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StrSlice

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

StrSlice represents a string or an array of strings. We need to override the json decoder to accept both options.

func New

func New(parts ...string) *StrSlice

New creates an StrSlice based on the specified parts (as strings).

func (*StrSlice) Len

func (e *StrSlice) Len() int

Len returns the number of parts of the StrSlice.

func (*StrSlice) MarshalJSON

func (e *StrSlice) MarshalJSON() ([]byte, error)

MarshalJSON Marshals (or serializes) the StrSlice into the json format. This method is needed to implement json.Marshaller.

func (*StrSlice) Slice

func (e *StrSlice) Slice() []string

Slice gets the parts of the StrSlice as a Slice of string.

func (*StrSlice) ToString

func (e *StrSlice) ToString() string

ToString gets space separated string of all the parts.

func (*StrSlice) UnmarshalJSON

func (e *StrSlice) UnmarshalJSON(b []byte) error

UnmarshalJSON decodes the byte slice whether it's a string or an array of strings. This method is needed to implement json.Unmarshaler.

Jump to

Keyboard shortcuts

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