time

package
v0.0.0-...-29e199f Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package time defines time based on the domain logic. It ensures that time within the application is aligned with the requirements and constraints dictated by the domain.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Timestamp

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

Timestamp defines an instant in time with milliseconds precision.

func Now

func Now() Timestamp

Now creates a new Timestamp with the current instant of time in milliseconds since January 1, 1970, UTC

func TimestampFromInt64

func TimestampFromInt64(src int64) Timestamp

TimestampFromInt64 creates a new Timestamp from the provided int64

func (Timestamp) Add

func (t Timestamp) Add(amount int64) Timestamp

Add creates a new Timestamp with the result of the sum for the timestamp and the amount provided as parameter.

func (Timestamp) MarshalJSON

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

MarshalJSON returns Timestamp JSON-marshalled output or error if it fails

func (Timestamp) String

func (t Timestamp) String() string

String returns a string representation of Timestamp

func (Timestamp) Sub

func (t Timestamp) Sub(amount int64) Timestamp

Sub creates a new Timestamp with the result of the rest for the timestamp and the amount provided as parameter.

func (Timestamp) ToInt64

func (t Timestamp) ToInt64() int64

ToInt64 formats Timestamp to int64

func (Timestamp) UnixNano

func (t Timestamp) UnixNano() int64

UnixNano returns the timestamp as a Unix time, the number of nanoseconds elapsed since January 1, 1970 UTC.

func (*Timestamp) UnmarshalJSON

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

UnmarshalJSON unmarshalls JSON data into Timestamp or returns an error if it fails

Jump to

Keyboard shortcuts

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