datepattern

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package datepattern translates GoBan's `datepattern:` rule field into a Go time-layout string. Operators write either a named preset (sshd, iso8601, rfc3339, etc.) for ergonomics or a raw Go layout literal for anything custom. Resolve does the dispatch and is intentionally tiny — the bulk of date handling lives in the rule processor.

Recognised presets cover the log formats GoBan's bundled rule library targets. New presets are cheap to add but they should reflect real-world log shapes, not theoretical ones — every preset is a maintenance commitment.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Presets

func Presets() []string

Presets returns the recognised preset names, sorted for documentation use. Returned slice is a copy; callers may mutate it freely.

func Resolve

func Resolve(spec string) (string, error)

Resolve returns the Go time layout corresponding to spec. spec may be:

  • a recognised preset name (case-insensitive) — returns the canonical layout
  • a raw Go layout literal containing the reference year "2006" — returned as-is

Anything else returns an error. The "contains 2006" heuristic is how Go's own time package identifies a layout, so accepting it here keeps the ergonomic story consistent: if it parses with time.Parse it'll work as a datepattern.

Types

This section is empty.

Jump to

Keyboard shortcuts

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