Documentation
¶
Overview ¶
Package cliutil provides shared filter-parsing and output helpers used by both cmd/bintrail/ commands and cmd/bintrail-mcp/.
Index ¶
- func BuildIndexFilters(schemas, tables string) event.Filters
- func IsValidFormat(s string) bool
- func IsValidOutputFormat(s string) bool
- func OutputJSON(v any) error
- func ParseByteSize(s string) (int64, error)
- func ParseEventType(s string) (*event.EventType, error)
- func ParseRetain(s string) (time.Duration, error)
- func ParseSchemaList(s string) []string
- func ParseTime(s string) (*time.Time, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildIndexFilters ¶
BuildIndexFilters builds an event.Filters from comma-separated schema and table flag values.
func IsValidFormat ¶
IsValidFormat reports whether s is a supported query output format (table, json, or csv).
func IsValidOutputFormat ¶
IsValidOutputFormat reports whether s is a supported general output format (text or json). Used by commands other than query (init, snapshot, index, status, recover, etc.).
func ParseByteSize ¶ added in v0.17.0
ParseByteSize parses a human-readable byte size string like "256MB" or "1GB". Plain integers are treated as bytes. Returns 0 for "0" (unlimited). Shared by the agent (--buffer-max-bytes) and reconstruct (--chunk-size) commands.
func ParseEventType ¶
ParseEventType converts an event-type string to a *event.EventType. Returns nil for an empty string (meaning "all types").
func ParseRetain ¶
ParseRetain parses a retain string like "7d" or "24h" into a time.Duration. Supported units: 'd' (days), 'h' (hours). The number must be a positive integer.
func ParseSchemaList ¶
ParseSchemaList splits a comma-separated schema string into a trimmed slice, dropping empty entries. Returns nil if the input is empty.
func ParseTime ¶
ParseTime parses a datetime string as UTC. Accepts three formats (tried in order):
- MySQL datetime: "2006-01-02 15:04:05" (interpreted as UTC)
- RFC 3339: "2006-01-02T15:04:05Z07:00" (timezone from string)
- Date-only: "2006-01-02" (interpreted as midnight UTC)
Returns nil for an empty string.
Types ¶
This section is empty.