jsontypes

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Optional

type Optional[T any] struct {
	Defined bool
	Value   *T
}

func (*Optional[T]) UnmarshalJSON

func (o *Optional[T]) UnmarshalJSON(data []byte) error

UnmarshalJSON is implemented by deferring to the wrapped type (T). It will be called only if the value is defined in the JSON payload.

type Time added in v0.3.6

type Time time.Time

Time is a custom time type that serializes to JSON with millisecond precision (3 decimal places)

func Now added in v0.3.6

func Now() Time

Now returns the current time as Time type

func Parse added in v0.3.6

func Parse(layout, value string) (Time, error)

Parse parses a time string and returns a Time

func (Time) MarshalJSON added in v0.3.6

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

MarshalJSON formatiert mit nur 3 Nachkommastellen

func (*Time) Scan added in v0.3.6

func (t *Time) Scan(value interface{}) error

GORM Scan interface - reads from database

func (Time) String added in v0.3.6

func (t Time) String() string

String returns the time formatted as RFC3339 with millisecond precision

func (Time) Time added in v0.3.6

func (t Time) Time() time.Time

Time returns the underlying time.Time

func (*Time) UnmarshalJSON added in v0.3.6

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

UnmarshalJSON parses a JSON string into Time

func (Time) Value added in v0.3.6

func (t Time) Value() (driver.Value, error)

GORM Value interface - writes to database

Jump to

Keyboard shortcuts

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