timestamp

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2024 License: MIT Imports: 3 Imported by: 0

README

Timestamp

Package responsible for handling dates with validations and commonly used functions in G3deon applications.

Translations

You can view the documentation of this package in your preferred language:

Frequently Asked Questions

Why not use timestamppb?

This package is an "extension" of the timestamppb package. We have implemented commonly used functions in our applications to improve code maintenance and scalability.

Examples

Use timestamp in your structure for handling dates such as expiration date and creation of a subscription.

import (
	"time"
	
	"go.g3deon.com/pkg/timestamp"
)

type Subscription struct {
	ExpirationDate *timestamp.Timestamp
	// other fields
}

func NewSubscription() *Subscription {
	expiration := time.Now().Add(time.Hour * 24 * 14)
	return &Subscription{
		ExpirationDate: timestamp.FromTime(expiration),
	}
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Timestamp

type Timestamp struct {
	*timestamp.Timestamp
}

func FromTime

func FromTime(t time.Time) *Timestamp

func Now

func Now() *Timestamp

func (*Timestamp) IsFuture

func (t *Timestamp) IsFuture() bool

Jump to

Keyboard shortcuts

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