Documentation
¶
Index ¶
- Constants
- Variables
- func DetectFormat(rd io.Reader) (format.FactoryI, int64, error)
- func GetTimestampFormat(f TimestampFmt) (format.TimeFormatCbT, error)
- func TryTimestampFormat(exp string, fmtStr TimestampFmt, buf []byte, maxTries int) (format.FactoryI, int64, error)
- func TryTimestampFormats(specs []FmtSpec, data []byte, maxTries int) (factory format.FactoryI, stamp int64)
- type FmtSpec
- type TimestampFmt
Constants ¶
View Source
const (
DefaultSkip = 50
)
Variables ¶
View Source
var Defaults = []FmtSpec{ { Format: FmtEpochAny, Pattern: `"time":(\d{16,19})`, }, { Format: FmtRfc3339, Pattern: `^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+\-]\d{2}:\d{2})) `, }, { Format: TimestampFmt("2006-01-02 15:04:05,00000"), Pattern: `^(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{5}) `, }, { Format: TimestampFmt("2006-01-02 15:04:05.000000-0700"), Pattern: `^(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d{6}[+-]\d{4}) `, }, { Format: TimestampFmt("2006-01-02 15:04:05.000"), Pattern: `^(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d{3}) `, }, { Format: TimestampFmt("2006-01-02 15:04:05"), Pattern: `^(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}) `, }, { Format: TimestampFmt("Jan 2 15:04:05.000000"), Pattern: `^([A-Z][a-z]{2}\s{1,2}\d{1,2}\s\d{2}:\d{2}:\d{2}\.\d{6}) `, }, { Format: TimestampFmt("Jan 2 15:04:05"), Pattern: `^([A-Z][a-z]{2}\s{1,2}\d{1,2}\s\d{2}:\d{2}:\d{2}) `, }, { Format: TimestampFmt("0102 15:04:05.000000"), Pattern: `^[IWEF](\d{4} \d{2}:\d{2}:\d{2}\.\d{6}) `, }, { Format: TimestampFmt("2006-01-02 15:04:05,000"), Pattern: `^\[(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{3})\] `, }, { Format: TimestampFmt("2006/01/02 15:04:05"), Pattern: `^(\d{4}/\d{2}/\d{2} \d{2}:\d{2}:\d{2}) `, }, { Format: TimestampFmt("01/02/2006, 15:04:05"), Pattern: `^(\d{2}/\d{2}/\d{4}, \d{2}:\d{2}:\d{2}) `, }, { Format: TimestampFmt("02 Jan 2006 15:04:05.000"), Pattern: `^(\d{2} [A-Z][a-z]{2} \d{4} \d{2}:\d{2}:\d{2}\.\d{3}) `, }, { Format: TimestampFmt("2006 Jan 02 15:04:05.000"), Pattern: `^(\d{4} [A-Z][a-z]{2} \d{2} \d{2}:\d{2}:\d{2}\.\d{3}) `, }, { Format: TimestampFmt("02/Jan/2006:15:04:05.000"), Pattern: `^(\d{2}/[A-Z][a-z]{2}/\d{4}:\d{2}:\d{2}:\d{2}\.\d{3}) `, }, { Format: TimestampFmt("01/02/2006 03:04:05 PM"), Pattern: `^(\d{2}/\d{2}/\d{4} \d{2}:\d{2}:\d{2} (AM|PM)) `, }, { Format: TimestampFmt("2006 Jan 02 15:04:05"), Pattern: `^(\d{4} [A-Z][a-z]{2} \d{2} \d{2}:\d{2}:\d{2}) `, }, { Format: FmtRfc3339, Pattern: `"timestamp"\s*:\s*"([^"]+)"`, }, { Format: FmtRfc3339, Pattern: `"ts"\s*:\s*"([^"]+)"`, }, { Format: TimestampFmt("2006/01/02 15:04:05.000000"), Pattern: `^\[\d+\]\s+(\d{4}/\d{2}/\d{2} \d{2}:\d{2}:\d{2}\.\d{6}) `, }, { Format: FmtRfc3339, Pattern: `"creationTimestamp":"([0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z)"`, }, { Format: TimestampFmt("2006-01-02T15:04:05.000-0700"), Pattern: `^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}[+-]\d{4})\t`, }, { Format: FmtDotNotation, Pattern: `"ts"\s*:\s*([0-9]+(?:\.[0-9]+)?)`, }, { Format: TimestampFmt("2006-01-02T15:04:05.000000000Z"), Pattern: `ts=([0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{9}Z)`, }, { Format: TimestampFmt("2006-01-02T15:04:05.000000Z"), Pattern: `"timestamp"\s*:\s*"([0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{6}Z)"`, }, { Format: FmtEpochAny, Pattern: `/Date\((\d+)\)`, }, { Format: FmtRfc3339, Pattern: `time="([^"]+)"`, }, }
View Source
var (
ErrInvalidTimestampFormat = errors.New("invalid timestamp format")
)
Functions ¶
func GetTimestampFormat ¶
func GetTimestampFormat(f TimestampFmt) (format.TimeFormatCbT, error)
func TryTimestampFormat ¶
Types ¶
type FmtSpec ¶
type FmtSpec struct {
Pattern string
Format TimestampFmt
}
type TimestampFmt ¶
type TimestampFmt string
const ( FmtRfc3339 TimestampFmt = "rfc3339" FmtRfc3339Nano TimestampFmt = "rfc3339nano" FmtUnix TimestampFmt = "unix" FmtEpochAny TimestampFmt = "epochany" FmtEpochSeconds TimestampFmt = "epochseconds" FmtEpochMillis TimestampFmt = "epochmillis" FmtEpochMicros TimestampFmt = "epochmicros" FmtEpochNanos TimestampFmt = "epochnanos" FmtDotNotation TimestampFmt = "dotnotation" )
func (TimestampFmt) String ¶
func (f TimestampFmt) String() string
Click to show internal directories.
Click to hide internal directories.