types

package
Version: v0.0.0-...-d462298 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EveryWeek     = "everyWeek"
	EveryDay      = "everyDay"
	EveryTwoWeeks = "everyTwoWeeks"
	EveryMonth    = "everyMonth"
	EveryDuration = "everyDuration"
)
View Source
const (
	DateFormat   = "2006-01-02"
	DateFormatTZ = "2006-01-02MST"
	TimeFormat   = "2006-01-02T15:04"
	TimeFormatTZ = "2006-01-02T15:04MST"
)

Variables

View Source
var EST, PST *time.Location

Exposed for testing other packages

View Source
var IDArrayProto = &IDArray{}

Functions

This section is empty.

Types

type ByteSize

type ByteSize int64

func ParseByteSize

func ParseByteSize(str string) (ByteSize, error)

func (ByteSize) String

func (size ByteSize) String() string

type Getter

type Getter interface {
	Get(Value)
}

type ID

type ID string

func (ID) GetID

func (id ID) GetID() ID

func (ID) String

func (id ID) String() string

type IDArray

type IDArray []ID

func (IDArray) GetAt

func (p IDArray) GetAt(n int) Value

func (IDArray) InstanceOf

func (p IDArray) InstanceOf() ValueArray

func (IDArray) Len

func (p IDArray) Len() int

func (*IDArray) Ref

func (p *IDArray) Ref() interface{}

func (*IDArray) Resize

func (p *IDArray) Resize(n int)

func (IDArray) SetAt

func (p IDArray) SetAt(n int, v Value)

type IDSet

type IDSet struct {
	ValueSet
}

func NewIDSet

func NewIDSet(vv ...ID) *IDSet

func (*IDSet) MarshalJSON

func (i *IDSet) MarshalJSON() ([]byte, error)

func (*IDSet) Set

func (i *IDSet) Set(v ID)

func (*IDSet) UnmarshalJSON

func (i *IDSet) UnmarshalJSON(data []byte) error

type IntSet

type IntSet struct {
	ValueSet
}

func NewIntSet

func NewIntSet(vv ...IntValue) *IntSet

func (*IntSet) Get

func (set *IntSet) Get(id ID) int64

func (*IntSet) MarshalJSON

func (set *IntSet) MarshalJSON() ([]byte, error)

func (*IntSet) Set

func (set *IntSet) Set(id ID, v int64)

func (*IntSet) TestAsMap

func (set *IntSet) TestAsMap() map[ID]int64

func (*IntSet) UnmarshalJSON

func (set *IntSet) UnmarshalJSON(data []byte) error

type IntValue

type IntValue struct {
	ID    ID
	Value int64
}

func NewIntValue

func NewIntValue(id ID, value int64) IntValue

func (IntValue) GetID

func (ii IntValue) GetID() ID

type Interval

type Interval struct {
	Start  Time
	Finish Time
}

func MustParseInterval

func MustParseInterval(start, finish string) Interval

func NewDurationInterval

func NewDurationInterval(start Time, d time.Duration) Interval

func NewInterval

func NewInterval(start, finish Time) Interval

func (*Interval) IsEmpty

func (i *Interval) IsEmpty() bool

func (*Interval) Overlaps

func (i *Interval) Overlaps(other Interval) bool

type Period

type Period struct {
	Period   string
	Duration time.Duration `json:",omitempty"`
}

func (*Period) AverageDuration

func (p *Period) AverageDuration() time.Duration

func (*Period) ForNumber

func (p *Period) ForNumber(beginning Time, num int) Time

func (*Period) ForTime

func (p *Period) ForTime(beginning, forTime Time) (int, Time)

func (*Period) Set

func (p *Period) Set(in string) error

func (*Period) String

func (p *Period) String() string

func (*Period) Type

func (p *Period) Type() string

type Setter

type Setter interface {
	Set(Value)
}

type Time

type Time struct {
	time.Time
}

func MustParseTime

func MustParseTime(in string) Time

func NewTime

func NewTime(t time.Time) Time

func (Time) In

func (t Time) In(l *time.Location) Time

func (*Time) MarshalJSON

func (t *Time) MarshalJSON() ([]byte, error)

func (*Time) Set

func (t *Time) Set(in string) error

Set implements pflag.Var, treats the parameter as UTC; to parse local times, use t.In(location) before calling fs.Parse().

func (Time) String

func (t Time) String() string

String is in UTC, use LocalString for local time

func (*Time) Type

func (t *Time) Type() string

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(data []byte) error

type Value

type Value interface {
	GetID() ID
}

type ValueArray

type ValueArray interface {
	Len() int
	GetAt(int) Value
	SetAt(int, Value)
	InstanceOf() ValueArray
	Ref() interface{}
	Resize(int)
}

type ValueSet

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

func NewValueSet

func NewValueSet(proto ValueArray, vv ...Value) *ValueSet

func (*ValueSet) AsArray

func (set *ValueSet) AsArray(out ValueArray)

func (*ValueSet) Contains

func (set *ValueSet) Contains(id ID) bool

func (*ValueSet) Delete

func (set *ValueSet) Delete(toDelete ID)

func (*ValueSet) From

func (set *ValueSet) From(other *ValueSet)

func (*ValueSet) Get

func (set *ValueSet) Get(id ID) Value

func (*ValueSet) GetAt

func (set *ValueSet) GetAt(n int) Value

func (*ValueSet) IDs

func (set *ValueSet) IDs() []ID

func (*ValueSet) IsEmpty

func (set *ValueSet) IsEmpty() bool

func (*ValueSet) Len

func (set *ValueSet) Len() int

func (*ValueSet) MarshalJSON

func (set *ValueSet) MarshalJSON() ([]byte, error)

func (*ValueSet) Set

func (set *ValueSet) Set(vv ...Value)

func (*ValueSet) SetAt

func (set *ValueSet) SetAt(n int, v Value)

func (*ValueSet) TestAsArray

func (set *ValueSet) TestAsArray(out ValueArray)

func (*ValueSet) TestIDs

func (set *ValueSet) TestIDs() []string

func (*ValueSet) UnmarshalJSON

func (set *ValueSet) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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