fix: strict ClockTime parsing and ISODuration SQL

Validate constructors, strict HH:MM:SS parse, UTC ClockTimeFromTime,
ISODuration Value/Scan, Compare and TextMarshaler, codec.go split.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-29 18:01:08 -07:00
parent 49ac7dd22a
commit a1284075aa
7 changed files with 409 additions and 187 deletions
+14
View File
@@ -0,0 +1,14 @@
// Package clocktime provides ClockTime (time-of-day) and ISODuration types with
// JSON, GraphQL, SQL, and text serialization.
//
// # ClockTime
//
// [ClockTime] stores HH:MM:SS without a date. Use [ParseClockTime] for strict parsing.
// Optional fields should use *ClockTime; [ClockTime.IsZero] is true only for nil pointers.
// Midnight 00:00:00 is valid—use [ClockTime.IsMidnight] to test for midnight.
//
// # ISODuration
//
// [ISODuration] wraps [time.Duration] with ISO 8601 formatting via sosodev/duration.
// SQL storage uses int64 nanoseconds; strings are also accepted on scan.
package clocktime