parsers

package
v0.0.0-...-3ffe1d7 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2024 License: ISC Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEmptyLog = errors.New("no valid posts found in log")

ErrEmptyLog is returned by ParseLog if there are no (valid) posts in the log.

View Source
var ErrSkip = errors.New("parsers: skip this post")

Functions

func ForumLogMetadata

func ForumLogMetadata(data string) map[string][]string

ForumLogMetadata parses metadata, discards the broken parts, and returns the parsed data as a map (`m`) and the position of the first IRC post (`n`)

func IRCCloudPost

func IRCCloudPost(line string, tz *time.Location) (models.Post, error)

IRCCloudPost parses a post from a mirc-like line. If the previous post is included (it can be empty), it will be used to determine whether midnight has passed.

func IsParseError

func IsParseError(err error) bool

func MircPost

func MircPost(line string, date time.Time, prev models.Post) (models.Post, error)

MircPost parses a post from a mirc-like line. If the previous post is included (it can be empty), it will be used to determine whether midnight has passed.

Types

type ParseError

type ParseError struct {
	Line    string
	Problem string
}

func (*ParseError) Error

func (e *ParseError) Error() string

type ParsedLog

type ParsedLog struct {
	Log   models.Log
	Posts []*models.Post
}

A ParsedLog contains the parsed log header and its posts.

func ForumLog

func ForumLog(data string, tz *time.Location) ([]ParsedLog, error)

ForumLog parses the logs from the data.

func IRCCloudLog

func IRCCloudLog(lines []string, location *time.Location, threshold time.Duration) (*ParsedLog, int, error)

IRCCloudLog parses the log and returns the things that can be gleamed from them.

func IRCCloudLogs

func IRCCloudLogs(data string, location *time.Location, threshold time.Duration) ([]ParsedLog, error)

func MircLog

func MircLog(data string, date time.Time, strict bool) (*ParsedLog, error)

MircLog parses the log and returns the things that can be gleamed from them.

Jump to

Keyboard shortcuts

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