Documentation
¶
Overview ¶
Package durable contains validation shared by public construction and the PostgreSQL store for values whose durable representation is narrower than their Go representation.
Index ¶
- Constants
- func AddExactDuration(field string, base time.Time, value time.Duration) (time.Time, error)
- func AddPostgresInteger(field string, value, delta int, minimum, maximum int64) (int, error)
- func CeilMilliseconds(field string, value time.Duration) (time.Duration, int64, error)
- func ExactMilliseconds(field string, value time.Duration) (int64, error)
- func MillisecondsDuration(field string, value int64) (time.Duration, error)
- func PostgresInteger(field string, value int, minimum, maximum int64) error
- func PostgresInteger32(field string, value int, minimum, maximum int64) (int32, error)
Constants ¶
Variables ¶
This section is empty.
Functions ¶
func AddExactDuration ¶
AddExactDuration makes validation precede durable timestamp arithmetic.
func AddPostgresInteger ¶
AddPostgresInteger validates a PostgreSQL integer transition without doing architecture-sized arithmetic first.
func CeilMilliseconds ¶ added in v0.3.0
CeilMilliseconds normalizes a non-negative public duration upward to its durable whole-millisecond representation. Feature-specific callers retain ownership of zero semantics. Values whose ceiling cannot be represented as a time.Duration are rejected instead of wrapping.
func ExactMilliseconds ¶
ExactMilliseconds converts a non-negative duration to its durable whole- millisecond representation. Callers enforce feature-specific zero semantics.
func MillisecondsDuration ¶
MillisecondsDuration converts a non-negative durable millisecond value to a Go duration without overflowing the narrower nanosecond representation.
func PostgresInteger ¶
PostgresInteger validates a Go int before it is written to a PostgreSQL integer. Bounds are int64 so the same call is correct on 32- and 64-bit Go.
Types ¶
This section is empty.