Documentation ¶
Index ¶
- Constants
- type Duration
- type ISO8601
- type KitckenTime
- type SimpleDate
- func (t SimpleDate) IsZero() bool
- func (t SimpleDate) MarshalJSON() ([]byte, error)
- func (t *SimpleDate) Scan(src interface{}) error
- func (t SimpleDate) String() string
- func (t SimpleDate) ToTime() time.Time
- func (t *SimpleDate) UnmarshalJSON(data []byte) error
- func (t SimpleDate) Value() (driver.Value, error)
- type TimeNotationDuration
Constants ¶
const ( // ISO8601Layout holds the time layout for the the javascript iso time. // Read more at: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString. ISO8601Layout = "2006-01-02T15:04:05" // ISO8601ZLayout same as ISO8601Layout but with the timezone suffix. ISO8601ZLayout = "2006-01-02T15:04:05Z" )
const KitckenTimeLayout = "3:04 PM"
KitckenTimeLayout represents the "3:04 PM" Go time format, similar to time.Kitcken.
const SimpleDateLayout = "2006-01-02"
SimpleDateLayout represents the "year-month-day" Go time format.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Duration ¶
Duration is a JSON representation of the standard Duration type, until Go version 2 supports it under the hoods.
func (Duration) MarshalJSON ¶
func (Duration) ToDuration ¶
func (*Duration) UnmarshalJSON ¶
type ISO8601 ¶
ISO8601 describes a time compatible with javascript time format.
func ParseISO8601 ¶
ParseISO8601 reads from "s" and returns the ISO8601 time.
func (ISO8601) IsZero ¶
IsZero reports whether "t" is zero time. It completes the pg.Zeroer interface.
func (ISO8601) MarshalJSON ¶
MarshalJSON writes a quoted string in the ISO8601 time format.
func (ISO8601) String ¶
String returns the text representation of the "t" using the ISO8601 time layout.
func (*ISO8601) UnmarshalJSON ¶
UnmarshalJSON parses the "b" into ISO8601 time.
type KitckenTime ¶
KitckenTime holds a json "3:04 PM" time.
func ParseKitchenTime ¶
func ParseKitchenTime(s string) (KitckenTime, error)
ParseKitchenTime reads from "s" and returns the KitckenTime time.
func (KitckenTime) IsZero ¶
func (t KitckenTime) IsZero() bool
IsZero reports whether "t" is zero time. It completes the pg.Zeroer interface.
func (KitckenTime) MarshalJSON ¶
func (t KitckenTime) MarshalJSON() ([]byte, error)
MarshalJSON returns the json representation of the "t".
func (*KitckenTime) Scan ¶
func (t *KitckenTime) Scan(src interface{}) error
Scan completes the pg and native sql driver.Scanner interface reading functionality of a custom type.
func (KitckenTime) String ¶
func (t KitckenTime) String() string
String returns the text representation of the date formatted based on the `KitckenTimeLayout`. If date is zero it returns an empty string.
func (*KitckenTime) UnmarshalJSON ¶
func (t *KitckenTime) UnmarshalJSON(data []byte) error
UnmarshalJSON binds the json "data" to "t" with the `KitckenTimeLayout`.
func (KitckenTime) Value ¶
func (t KitckenTime) Value() time.Time
Value returns the standard time type.
type SimpleDate ¶
SimpleDate holds a json "year-month-day" time.
func ParseSimpleDate ¶
func ParseSimpleDate(s string) (SimpleDate, error)
ParseSimpleDate reads from "s" and returns the SimpleDate time.
func (SimpleDate) IsZero ¶
func (t SimpleDate) IsZero() bool
IsZero reports whether "t" is zero time. It completes the pg.Zeroer interface.
func (SimpleDate) MarshalJSON ¶
func (t SimpleDate) MarshalJSON() ([]byte, error)
MarshalJSON returns the json representation of the "t".
func (*SimpleDate) Scan ¶
func (t *SimpleDate) Scan(src interface{}) error
Scan completes the pg and native sql driver.Scanner interface reading functionality of a custom type.
func (SimpleDate) String ¶
func (t SimpleDate) String() string
String returns the text representation of the date formatted based on the `SimpleDateLayout`. If date is zero it returns an empty string.
func (SimpleDate) ToTime ¶
func (t SimpleDate) ToTime() time.Time
ToTime returns the standard time type.
func (*SimpleDate) UnmarshalJSON ¶
func (t *SimpleDate) UnmarshalJSON(data []byte) error
UnmarshalJSON binds the json "data" to "t" with the `SimpleDateLayout`.
type TimeNotationDuration ¶
TimeNotationDuration is a JSON representation of the standard Duration type in 00:00:00 (hour, minute seconds).
func (TimeNotationDuration) MarshalJSON ¶
func (d TimeNotationDuration) MarshalJSON() ([]byte, error)
func (*TimeNotationDuration) Set ¶
func (d *TimeNotationDuration) Set(v float64)
Set sets the value of duration in nanoseconds.
func (TimeNotationDuration) ToDuration ¶
func (d TimeNotationDuration) ToDuration() time.Duration
func (*TimeNotationDuration) UnmarshalJSON ¶
func (d *TimeNotationDuration) UnmarshalJSON(b []byte) error