utilities

package
v0.0.0-...-285413f Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2024 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const (
	MIN_DATE     = "0001-01-01T00:00:00Z"
	MAX_DATE     = "9999-12-31T23:59:59Z"
	DEFAULT_UUID = "00000000-0000-0000-0000-000000000000"
)

Variables

View Source
var (
	ErrUnsupportedConversion = errors.New("unsupported type conversion")
)

Functions

func SetDefaults

func SetDefaults[T any](t *T) error

Types

type Datetime

type Datetime time.Time

func (Datetime) AfterOrEqualTo

func (d Datetime) AfterOrEqualTo(u time.Time) bool

AfterOrEqualTo return true if a date is after or equal to another date , this should be considered for time overlap (touch boundaries)

func (Datetime) BeforeOrEqualTo

func (d Datetime) BeforeOrEqualTo(u time.Time) bool

BeforeOrEqualTo return true if a date is before or equal to another date , this should be considered for time overlap (touch boundaries)

func (Datetime) MarshalJSON

func (d Datetime) MarshalJSON() ([]byte, error)

func (Datetime) Max

func (d Datetime) Max(datetimes ...time.Time) time.Time

func (Datetime) Min

func (d Datetime) Min(datetimes ...time.Time) time.Time

func (*Datetime) UnmarshalJSON

func (d *Datetime) UnmarshalJSON(b []byte) error

type Nullable

type Nullable[T any] struct {
	Val   T
	Valid bool
}

func DefaultIfZero

func DefaultIfZero[T any](value T) Nullable[T]

func NewNullable

func NewNullable[T any](value T, isValid bool) Nullable[T]

func (Nullable[T]) MarshalJSON

func (n Nullable[T]) MarshalJSON() ([]byte, error)

func (*Nullable[T]) Scan

func (n *Nullable[T]) Scan(value interface{}) error

func (*Nullable[T]) UnmarshalJSON

func (n *Nullable[T]) UnmarshalJSON(data []byte) error

func (Nullable[T]) Value

func (n Nullable[T]) Value() (driver.Value, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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