exporter

package
v0.0.0-...-687e970 Latest Latest
Warning

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

Go to latest
Published: May 23, 2021 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Topic topicData

Functions

func Asset

func Asset(name string) ([]byte, error)

Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetDir

func AssetDir(name string) ([]string, error)

AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:

data/
  foo.txt
  img/
    a.png
    b.png

then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.

func AssetInfo

func AssetInfo(name string) (os.FileInfo, error)

AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetNames

func AssetNames() []string

AssetNames returns the names of the assets. nolint: deadcode

func MustAsset

func MustAsset(name string) []byte

MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables. nolint: deadcode

func RestoreAsset

func RestoreAsset(dir, name string) error

RestoreAsset restores an asset under the given directory

func RestoreAssets

func RestoreAssets(dir, name string) error

RestoreAssets restores an asset under the given directory recursively

Types

type Exporter

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

func From

func From(ctx context.Context, db *sqlx.DB, lang, csvPath string, wwwURL, langURL url.URL, extDataChannels ...<-chan ExtData) (m Exporter, destructor func(), err error)

func Open

func Open(ctx context.Context, db *sqlx.DB, lang string, wwwURL, langURL url.URL, extDataChannels ...<-chan ExtData) (m Exporter, destructor func(), err error)

func (Exporter) Everything

func (m Exporter) Everything(ctx context.Context, fail func(error) error) <-chan VFile

func (Exporter) Lang

func (m Exporter) Lang() string

func (Exporter) MaxTimestamp

func (m Exporter) MaxTimestamp() int64

func (Exporter) MaxYear

func (m Exporter) MaxYear() int64

func (Exporter) MinTimestamp

func (m Exporter) MinTimestamp() int64

func (Exporter) MinYear

func (m Exporter) MinYear() int64

func (Exporter) Pages

func (m Exporter) Pages(ctx context.Context, fail func(error) error, out chan<- VFile)

func (Exporter) TopTens

func (m Exporter) TopTens(ctx context.Context, fail func(error) error, out chan<- VFile)

func (Exporter) WWWURL

func (m Exporter) WWWURL() string

type ExtData

type ExtData struct {
	ID     uint32
	Fields map[string]interface{}
}

ExtData represents external data. The underlying type of the interface must be of type map.

func (ExtData) Less

func (v1 ExtData) Less(v2 ExtData) bool

type Info

type Info struct {
	*Exporter
	Page                   Page
	Index2Measurement      map[string]Measurement
	Index2YearMeasurements map[string][]YearMeasurement
	Links                  []Page
	ExternalFields         map[string]interface{}
}

func (Info) FilePath

func (i Info) FilePath() string

func (Info) Rankings

func (i Info) Rankings() (rankings []ranking)

type Measurement

type Measurement struct {
	Value, Percentile, DensePercentile    float64
	Rank                                  int
	TopicPercentile, TopicDensePercentile float64
	TopicRank                             int
}

type Page

type Page struct {
	ID              uint32
	Title, Abstract string
	ParentID        uint32
	Type            string
	CreationYear    int
}

func (Page) Topic

func (p Page) Topic() string

func (Page) UnderscoredTitle

func (p Page) UnderscoredTitle() string

type SplittedAnnualIndexRanking

type SplittedAnnualIndexRanking struct {
	TTKey
	Ranking []Page
}

type TTKey

type TTKey struct {
	Year    uint32 //0 iff it's all time
	Index   string
	TopicID uint32 //0 iff it's all
}

type TopTenInfo

type TopTenInfo struct {
	*Exporter
	SplittedAnnualIndexRanking
}

func (TopTenInfo) FilePath

func (i TopTenInfo) FilePath() string

func (TopTenInfo) Span

func (i TopTenInfo) Span() string

func (TopTenInfo) Title

func (i TopTenInfo) Title() string

func (TopTenInfo) Topic

func (i TopTenInfo) Topic() string

type VFile

type VFile struct {
	Path, Data string
}

type YearMeasurement

type YearMeasurement struct {
	Measurement
	Year int
}

Jump to

Keyboard shortcuts

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