backwardio

package module
v0.0.0-...-d9cf8f2 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2021 License: ISC Imports: 3 Imported by: 1

README

backwardio

Package backwardio implements a buffered scanner that scans backwards.

Test Coverage
―❤―▶ go test -coverprofile=/dev/null
PASS
coverage: 100.0% of statements
ok  	github.com/diamondburned/backwardio	0.002s

Why

This is useful for parsing logs or files of line-delimited JSON from the latest entry first.

Actually, why?

Because I wrote this library for that purpose, realized I don't need it anymore, and now I'm making it a library so I don't feel like I wasted my time.

Documentation

Overview

Package backwardio implements a buffered scanner that scans backwards.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Scanner

type Scanner struct {
	// contains filtered or unexported fields
}

Scanner is similar to bufio.Scanner, except things are scanned from the bottom up.

func NewScanner

func NewScanner(r io.ReadSeeker) *Scanner

NewScanner creates a new backwards scanner.

func (*Scanner) ReadUntil

func (r *Scanner) ReadUntil(delim byte) ([]byte, error)

ReadUntil reads from the bottom up until the given delimiter is encountered.

Jump to

Keyboard shortcuts

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