Documentation ¶
Index ¶
- Variables
- func DurString(d *Duration) string
- func Max(times ...time.Time) time.Time
- func RFC3339(t *Time) string
- func Secs(f float64) time.Duration
- func TimeDifference(start *Time, end *Time) time.Duration
- func WithinRange(t time.Time, rng Range) bool
- type Duration
- func (d *Duration) D() time.Duration
- func (*Duration) Descriptor() ([]byte, []int)
- func (m *Duration) GetProtoDuration() *duration.Duration
- func (d *Duration) MarshalGQL(w io.Writer)
- func (d *Duration) MarshalJSON() ([]byte, error)
- func (d *Duration) PB() *duration.Duration
- func (*Duration) ProtoMessage()
- func (m *Duration) Reset()
- func (m *Duration) String() string
- func (d *Duration) UnmarshalGQL(v interface{}) error
- func (d *Duration) UnmarshalJSON(data []byte) error
- func (m *Duration) XXX_DiscardUnknown()
- func (m *Duration) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Duration) XXX_Merge(src proto.Message)
- func (m *Duration) XXX_Size() int
- func (m *Duration) XXX_Unmarshal(b []byte) error
- type Range
- type RelativeRange
- type Time
- func (t *Time) Add(p1 time.Duration) time.Time
- func (t *Time) AddDate(p1 int, p2 int, p3 int) time.Time
- func (t *Time) After(p1 time.Time) bool
- func (t *Time) AppendFormat(p1 []uint8, p2 string) []uint8
- func (t *Time) Before(p1 time.Time) bool
- func (t *Time) Clock() (int, int, int)
- func (t *Time) Date() (int, time.Month, int)
- func (t *Time) Day() int
- func (*Time) Descriptor() ([]byte, []int)
- func (t *Time) Equal(p1 time.Time) bool
- func (t *Time) Format(p1 string) string
- func (m *Time) GetProtoTime() *timestamp.Timestamp
- func (t *Time) GobEncode() ([]uint8, error)
- func (t *Time) Hour() int
- func (t *Time) ISOWeek() (int, int)
- func (t *Time) In(p1 *time.Location) time.Time
- func (t *Time) IsZero() bool
- func (t *Time) Local() time.Time
- func (t *Time) Location() *time.Location
- func (t *Time) MarshalBinary() ([]uint8, error)
- func (t Time) MarshalGQL(w io.Writer)
- func (t *Time) MarshalJSON() ([]byte, error)
- func (t *Time) MarshalText() ([]uint8, error)
- func (t *Time) Minute() int
- func (t *Time) Month() time.Month
- func (t *Time) Nanosecond() int
- func (t Time) PB() *timestamp.Timestamp
- func (*Time) ProtoMessage()
- func (m *Time) Reset()
- func (t *Time) Round(p1 time.Duration) time.Time
- func (t *Time) Second() int
- func (m *Time) String() string
- func (t *Time) Sub(p1 time.Time) time.Duration
- func (t Time) T() time.Time
- func (t *Time) Truncate(p1 time.Duration) time.Time
- func (t *Time) UTC() time.Time
- func (t *Time) Unix() int64
- func (t *Time) UnixNano() int64
- func (t *Time) UnmarshalGQL(v interface{}) error
- func (t *Time) UnmarshalJSON(data []byte) error
- func (t *Time) Weekday() time.Weekday
- func (m *Time) XXX_DiscardUnknown()
- func (m *Time) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Time) XXX_Merge(src proto.Message)
- func (m *Time) XXX_Size() int
- func (m *Time) XXX_Unmarshal(b []byte) error
- func (t *Time) Year() int
- func (t *Time) YearDay() int
- func (t *Time) Zone() (string, int)
Constants ¶
This section is empty.
Variables ¶
var ( // DurPB is a shorthand for this long function DurPB = ptypes.DurationProto // TimePB is a shorthand for this long function TimePB = ptypes.TimestampProto // ToTime is a shorthand for this long function ToTime = ptypes.Timestamp // NowPB is shorthand for this long function NowPB = ptypes.TimestampNow // Dur is shorthand for this long function Dur = ptypes.Duration )
Functions ¶
func TimeDifference ¶
TimeDifference returns the Duration between the given start and end times
Types ¶
type Duration ¶
type Duration struct { ProtoDuration *duration.Duration `protobuf:"bytes,1,opt,name=proto_duration,json=protoDuration,proto3" json:"proto_duration,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func MustDuration ¶
func NewDuration ¶
NewDuration instantiates a *chrono.Duration from a time.Duration
func NewDurationFromProto ¶
NewDurationFromProto instantiates a Duration from a protocol buffer *duration.Duration
func NewDurationFromString ¶
NewDurationFromString instantiates a Duration from a string
func (*Duration) Descriptor ¶
func (*Duration) GetProtoDuration ¶
func (*Duration) MarshalGQL ¶
MarshalGQL implements the graphql.Marshaler interface
func (*Duration) MarshalJSON ¶
MarshalJSON marshals the Duration into JSON
func (*Duration) ProtoMessage ¶
func (*Duration) ProtoMessage()
func (*Duration) UnmarshalGQL ¶
UnmarshalGQL implements the graphql.Unmarshaler interface
func (*Duration) UnmarshalJSON ¶
UnmarshalJSON unmarshals the duration encoded as JSON into a Duration
func (*Duration) XXX_DiscardUnknown ¶
func (m *Duration) XXX_DiscardUnknown()
func (*Duration) XXX_Marshal ¶
func (*Duration) XXX_Unmarshal ¶
type RelativeRange ¶
RelativeRange is a relative time range defined by the upper and lower durations. These values are used to create an absolute range centered around a time (like the current time)
type Time ¶
type Time struct { ProtoTime *timestamp.Timestamp `protobuf:"bytes,1,opt,name=proto_time,json=protoTime,proto3" json:"proto_time,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func NewFromString ¶
FromString instantiates a Time from a RFC3339 string
func (*Time) Descriptor ¶
func (*Time) GetProtoTime ¶
func (*Time) MarshalBinary ¶
func (Time) MarshalGQL ¶
MarshalGQL implements the graphql.Marshaler interface
func (*Time) MarshalJSON ¶
MarshalJSON marshals the Time into JSON
func (*Time) MarshalText ¶
func (*Time) Nanosecond ¶
func (*Time) ProtoMessage ¶
func (*Time) ProtoMessage()
func (*Time) UnmarshalGQL ¶
UnmarshalGQL implements the graphql.Unmarshaler interface
func (*Time) UnmarshalJSON ¶
UnmarshalJSON unmarshals the time encoded as a RFC3339 JSON string into a Time
func (*Time) XXX_DiscardUnknown ¶
func (m *Time) XXX_DiscardUnknown()