decoder

package
v0.0.0-...-e0cd53d Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package decoder implements a simple decoder for wiki pages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decoder

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

Decoder is an XML decoder tailored to the Wikipedia dataset.

func New

func New(r io.Reader) (*Decoder, error)

New instanciates a new Decoder.

It fail if it cannot find the mediawiki and siteinfo elements from the dataset.

func (*Decoder) Err

func (d *Decoder) Err() error

Err returns any error encountered by Next.

func (*Decoder) Next

func (d *Decoder) Next() bool

Next moves to the next element.

func (*Decoder) Scan

func (d *Decoder) Scan(v any) error

Scan scans an element.

type Page

type Page struct {
	ID        int64     `xml:"-"`
	UpdatedAt time.Time `xml:"revision>timestamp"`
	Title     string    `xml:"title"`
	Text      string    `xml:"revision>text"`
}

Page represents a page from Wikipedia.

Jump to

Keyboard shortcuts

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