dbtime

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 3 Imported by: 0 modules, 0 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

Package dbtime is the one format Haul uses for timestamps stored in SQLite TEXT columns.

Never bind a time.Time directly as a query argument: the SQLite driver stores it as time.Time.String() ("2026-11-18 17:26:54.587019257 +0000 UTC"), which is not RFC3339, doesn't round-trip through time.Parse with RFC3339, and is what Haul used to send to Pilot and Prism.

The stored format is fixed-width UTC with millisecond precision, "2006-01-02T15:04:05.000Z". It is valid RFC3339 (Go's time.RFC3339 and RFC3339Nano both parse it), it is exactly the ISO format every browser's Date parses, and because it is fixed-width it sorts correctly as text, so ORDER BY on these columns stays chronological.

Index

Constants

View Source
const Layout = "2006-01-02T15:04:05.000Z"

Layout is the stored format. Always UTC; the trailing Z is literal.

Variables

This section is empty.

Functions

func Format

func Format(t time.Time) string

Format returns t in the stored format.

func IsCanonical

func IsCanonical(s string) bool

IsCanonical reports whether s is already in the stored format.

func Normalize

func Normalize(s string) (out string, ok bool)

Normalize rewrites a stored timestamp into the current format. ok is false when s can't be parsed; s is then returned unchanged.

func Parse

func Parse(s string) (time.Time, error)

Parse reads a stored timestamp in the current format or any format older Haul versions wrote. The result is in UTC.

Types

This section is empty.

Jump to

Keyboard shortcuts

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