Caution
This module is deprecated and is provided for backward compatibility only. Do not use for new work.
timex.Timex enhances the standard time.Time to make it more compatible with JavaScript and SQL. It adjusts JSON marshaling of the zero time to null and infers the layout when parsing a string. It also implements the Scanner and Valuer interfaces for SQL integration.
With the introduction of omitzero in Go 1.24, there is no longer need for custom JSON marshaling code for time.Time.
If your project relies on the timex package in fabric v1.10 or earlier:
go get github.com/microbus-io/timex- Replace all imports of
github.com/microbus-io/fabric/timexwithgithub.com/microbus-io/timex - Replace all uses of
svc.NowX(ctx)withtimex.New(svc.Now(ctx))
Going forward:
- Use
omitzeroinstead ofomitemptywhen marshalingtime.Time - Use
sql.NullTimeto interface with the database