commonatlases

package
v0.90.1 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 2 Imported by: 1 module, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

commonatlases is a package full of `atlas.Entry` definions for common types in the standard library.

A frequently useful example is the standard library `time.Time` type, which is frequently serialized in some custom way: as a unix int for example, or perhaps an RFC3339 string; there are many popular choices. (`time.Time` is also an example of where *some* custom behavior is pretty much required, because a default struct-mapping is useless on a struct with no exported fields.)

Index

Constants

This section is empty.

Variables

View Source
var Time_AsRFC3339 = atlas.BuildEntry(time.Time{}).Transform().
	TransformMarshal(atlas.MakeMarshalTransformFunc(
		func(x time.Time) (string, error) {
			return x.Format(time.RFC3339), nil
		})).
	TransformUnmarshal(atlas.MakeUnmarshalTransformFunc(
		func(x string) (time.Time, error) {
			return time.Parse(time.RFC3339, x)
		})).
	Complete()
View Source
var Time_AsUnixInt = atlas.BuildEntry(time.Time{}).Transform().
	TransformMarshal(atlas.MakeMarshalTransformFunc(
		func(x time.Time) (int64, error) {
			return x.Unix(), nil
		})).
	TransformUnmarshal(atlas.MakeUnmarshalTransformFunc(
		func(x int64) (time.Time, error) {
			return time.Unix(x, 0).UTC(), nil
		})).
	Complete()

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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