date

package
v0.0.0-...-8d027c9 Latest Latest
Warning

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

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

Documentation

Overview

Package date provides time.Time derivatives that conform to the Swagger.io (https://swagger.io/) defined date formats: Date and DateTime. Both types may, in most cases, be used in lieu of time.Time types. And both convert to time.Time through a ToTime method.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ByUnmarshallingDate

func ByUnmarshallingDate(d *Date) autorest.RespondDecorator

ByUnmarshallingDate returns a RespondDecorator that decodes the http.Response Body into a Date pointed to by d.

func ByUnmarshallingTime

func ByUnmarshallingTime(t *Time) autorest.RespondDecorator

ByUnmarshallingTime returns a RespondDecorator that decodes the http.Response Body into a Time pointed to by t.

Types

type Date

type Date struct {
	time.Time
}

Date defines a type similar to time.Time but assumes a layout of RFC3339 full-date (i.e., 2006-01-02).

func ParseDate

func ParseDate(date string) (d Date, err error)

ParseDate create a new Date from the passed string.

func (Date) MarshalBinary

func (d Date) MarshalBinary() ([]byte, error)

MarshalBinary preserves the Date as a byte array conforming to RFC3339 full-date (i.e., 2006-01-02).

func (Date) MarshalJSON

func (d Date) MarshalJSON() (json []byte, err error)

MarshalJSON preserves the Date as a JSON string conforming to RFC3339 full-date (i.e., 2006-01-02).

func (Date) MarshalText

func (d Date) MarshalText() (text []byte, err error)

MarshalText preserves the Date as a byte array conforming to RFC3339 full-date (i.e., 2006-01-02).

func (Date) String

func (d Date) String() string

String returns the Date formatted as an RFC3339 full-date string (i.e., 2006-01-02).

func (Date) ToTime

func (d Date) ToTime() time.Time

ToTime returns a Date as a time.Time

func (*Date) UnmarshalBinary

func (d *Date) UnmarshalBinary(data []byte) error

UnmarshalBinary reconstitutes a Date saved as a byte array conforming to RFC3339 full-date (i.e., 2006-01-02).

func (*Date) UnmarshalJSON

func (d *Date) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON reconstitutes the Date from a JSON string conforming to RFC3339 full-date (i.e., 2006-01-02).

func (*Date) UnmarshalText

func (d *Date) UnmarshalText(data []byte) (err error)

UnmarshalText reconstitutes a Date saved as a byte array conforming to RFC3339 full-date (i.e., 2006-01-02).

type Time

type Time struct {
	time.Time
}

Time defines a type similar to time.Time but assumes a layout of RFC3339 date-time (i.e., 2006-01-02T15:04:05Z).

func ParseTime

func ParseTime(date string) (d Time, err error)

ParseTime creates a new Time from the passed string.

func (Time) MarshalBinary

func (d Time) MarshalBinary() ([]byte, error)

MarshalBinary preserves the Time as a byte array conforming to RFC3339 date-time (i.e., 2006-01-02T15:04:05Z).

func (Time) MarshalJSON

func (d Time) MarshalJSON() (json []byte, err error)

MarshalJSON preserves the Time as a JSON string conforming to RFC3339 date-time (i.e., 2006-01-02T15:04:05Z).

func (Time) MarshalText

func (d Time) MarshalText() (text []byte, err error)

MarshalText preserves the Time as a byte array conforming to RFC3339 date-time (i.e., 2006-01-02T15:04:05Z).

func (Time) String

func (d Time) String() string

String returns the Time formatted as an RFC3339 date-time string (i.e., 2006-01-02T15:04:05Z).

func (Time) ToTime

func (d Time) ToTime() time.Time

ToTime returns a Time as a time.Time

func (*Time) UnmarshalBinary

func (d *Time) UnmarshalBinary(data []byte) error

UnmarshalBinary reconstitutes a Time saved as a byte array conforming to RFC3339 date-time (i.e., 2006-01-02T15:04:05Z).

func (*Time) UnmarshalJSON

func (d *Time) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON reconstitutes the Time from a JSON string conforming to RFC3339 date-time (i.e., 2006-01-02T15:04:05Z).

func (*Time) UnmarshalText

func (d *Time) UnmarshalText(data []byte) (err error)

UnmarshalText reconstitutes a Time saved as a byte array conforming to RFC3339 date-time (i.e., 2006-01-02T15:04:05Z).

Jump to

Keyboard shortcuts

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