go4.org: go4.org/types Index | Files

package types

import "go4.org/types"

Package types provides various common types.

Index

Package Files

types.go

Variables

var EmptyBody io.ReadCloser = ioutil.NopCloser(strings.NewReader(""))

EmptyBody is a ReadCloser that returns EOF on Read and does nothing on Close.

var NopCloser io.Closer = CloseFunc(func() error { return nil })

NopCloser is an io.Closer that does nothing.

func NewOnceCloser Uses

func NewOnceCloser(c io.Closer) io.Closer

NewOnceCloser returns a Closer wrapping c which only calls Close on c once. Subsequent calls to Close return nil.

type ByTime Uses

type ByTime []time.Time

ByTime sorts times.

func (ByTime) Len Uses

func (s ByTime) Len() int

func (ByTime) Less Uses

func (s ByTime) Less(i, j int) bool

func (ByTime) Swap Uses

func (s ByTime) Swap(i, j int)

type CloseFunc Uses

type CloseFunc func() error

CloseFunc implements io.Closer with a function.

func (CloseFunc) Close Uses

func (fn CloseFunc) Close() error

type Time3339 Uses

type Time3339 time.Time

Time3339 is a time.Time which encodes to and from JSON as an RFC 3339 time in UTC.

func ParseTime3339OrNil Uses

func ParseTime3339OrNil(v string) *Time3339

func ParseTime3339OrZero Uses

func ParseTime3339OrZero(v string) Time3339

ParseTime3339OrZero parses a string in RFC3339 format. If it's invalid, the zero time value is returned instead.

func (*Time3339) IsAnyZero Uses

func (t *Time3339) IsAnyZero() bool

IsZero returns whether the time is Go zero or Unix zero.

func (Time3339) MarshalJSON Uses

func (t Time3339) MarshalJSON() ([]byte, error)

func (Time3339) String Uses

func (t Time3339) String() string

func (Time3339) Time Uses

func (t Time3339) Time() time.Time

Time returns the time as a time.Time with slightly less stutter than a manual conversion.

func (*Time3339) UnmarshalJSON Uses

func (t *Time3339) UnmarshalJSON(b []byte) error

Package types imports 8 packages (graph) and is imported by 41 packages. Updated 2016-07-16. Refresh now. Tools for package owners.