timerange

package
v1.9.7 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package timerange resolves user-supplied time-range inputs (a relative "since" duration or an explicit RFC3339 from/to pair) into a client.TimeRange. It is shared by the CLI flag layer and the MCP server so both surfaces accept the exact same grammar.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalid = errors.New("invalid time range")

ErrInvalid is wrapped by every validation failure in Resolve so callers can map any malformed combination to a single "invalid time range" error path.

Functions

func ParseRelativeDuration

func ParseRelativeDuration(s string) (time.Duration, error)

ParseRelativeDuration accepts time.ParseDuration's standard input plus a simple "Nd" form (positive integer days) which time.ParseDuration rejects. Compound forms like "7d2h" or "7D" are not supported on purpose.

func Resolve

func Resolve(since, from, to string) (client.TimeRange, error)

Resolve validates the since/from/to combination (empty string = unset) and returns the resulting TimeRange. The default (all empty) is "last 1 hour".

Types

This section is empty.

Jump to

Keyboard shortcuts

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