timefmt

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 10, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package timefmt holds the on-disk timestamp format shared by index/sqlite and internal/manifestcodec. Both write timestamps to durable storage and must agree on the byte-level format, or RebuildIndex (M3) cannot copy strings between subsystems without reformatting.

Format is RFC 3339 with second precision (no nanoseconds), always UTC. Sub-second precision is dropped on Format because it would defeat ArtifactID dedup: identical logical content must produce identical IDs, and time.Now() varies below the second.

Parse accepts the Nano variant in addition to the strict form for forward compatibility — if a future migration writes nanosecond timestamps, existing readers still work.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Format

func Format(t time.Time) string

Format returns the canonical on-disk representation of t. Zero Time encodes to the empty string; callers map that to SQL NULL or omit the JSON field as appropriate.

func Parse

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

Parse reads a timestamp written by Format. Empty string returns zero Time (matches the absent/NULL semantics of both SQL NullString and JSON omitempty fields). Accepts the Nano variant too for forward compatibility.

Types

This section is empty.

Jump to

Keyboard shortcuts

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