cli

package
v0.0.0-...-d81bb10 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package cli is a facade to the gutenfinder package that implements the behaviour needed for the Gutenfinder CLI application.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CLI

type CLI struct {
	Catalogue    Catalogue    `inject:"inline"`
	DB           DB           `inject:"inline"`
	Elastic      Elastic      `inject:"inline"`
	Web          Web          `inject:"inline"`
	SearchResult SearchResult `inject:"inline"`
}

CLI is the command line interface for Gutenfinder.

func (*CLI) SetParameters

func (cli *CLI) SetParameters(parameters *Parameters) error

SetParameters applies the given parameters to all the CLI subcommands.

type Catalogue

type Catalogue struct {
	Parameters *Parameters `inject:""`
}

Catalogue is a CLI subcommand for interacting with the Gutenfinder catalogue.

func (Catalogue) LinkAuthors

func (catalogue Catalogue) LinkAuthors(ctx context.Context) error

LinkAuthors creates and updates authors from EBook properties.

func (Catalogue) LoadText

func (catalogue Catalogue) LoadText(ctx context.Context) error

LoadText loads all EBooks in the database into Elasticsearch.

func (Catalogue) LoadXML

func (catalogue Catalogue) LoadXML(ctx context.Context) error

LoadXML loads all EBooks described by the Project Gutenberg .rdf catalogue data files into the database.

func (Catalogue) ScanXML

func (catalogue Catalogue) ScanXML(ctx context.Context) error

ScanXML reads all the Project Gutenberg .rdf catalogue files and writes their properties to the Output parameter.

func (Catalogue) Search

func (catalogue Catalogue) Search(ctx context.Context) error

Search finds SearchResults in the Gutenfinder catalogue and writes them to the Output parameter.

type CatalogueParameters

type CatalogueParameters struct {
	RDFRoot          string
	MirrorRoot       string
	MaxOpenFiles     int64
	ForceIndex       bool
	IndexWorkers     int
	IndexBulkActions int
	IndexBulkSize    int
}

CatalogueParameters are the CLI parameters for the Catalogue CLI subcommand.

type DB

type DB struct {
	Parameters *Parameters `inject:""`
}

DB is the CLI subcommand for interacting with the database.

func (DB) Migrate

func (db DB) Migrate(ctx context.Context) error

Migrate migrates the DB to appropriate version.

type DBParameters

type DBParameters struct {
	MigrateDatabaseName string
	MigrateSourceURL    string
	MigrationsTable     string
	MigrateDown         bool
	MigrateDrop         bool
	MigrateVersion      uint
}

DBParameters are parameters for the DB subcommand.

type Elastic

type Elastic struct {
	Parameters *Parameters `inject:""`
}

Elastic is the CLI subcommand to interact with Elasticsearch.

func (Elastic) Search

func (elastic Elastic) Search(ctx context.Context) error

Search performs full-text searches on Elasticsearch and writes the raw data to the Output parameter. Prefer Catalogue.Search for finding EBooks.

type ElasticParameters

type ElasticParameters struct {
	SearchField string
}

ElasticParameters are parameters for the Elastic CLI subcommand.

type Parameters

type Parameters struct {
	Input  io.Reader `inject:""`
	Output io.Writer `inject:""`

	PostgresConnection string
	ElasticURL         string
	SearchTerm         string

	CatalogueParameters
	ElasticParameters
	DBParameters
	WebParameters
	SearchResultParameters
}

Parameters represents the CLI parameters for Gutenfinder.

type SearchResult

type SearchResult struct {
	Parameters *Parameters `inject:""`
}

SearchResult is the CLI subcommand for interacting with saved Search Results.

func (SearchResult) Clean

func (searchResult SearchResult) Clean(ctx context.Context) error

Clean the SearchResults so that no results returned by Gutenfinder will be out of date with the current software or data.

type SearchResultParameters

type SearchResultParameters struct {
}

SearchResultParameters are the parameters for the SearchResult subcommand.

type Web

type Web struct {
	Parameters *Parameters `inject:""`
}

Web is the CLI subcommand for interacting with the internet over HTTP.

func (Web) Serve

func (web Web) Serve(ctx context.Context) error

Serve launches a HTTP server to provide Gutenfinder over the web.

type WebParameters

type WebParameters struct {
	HTTP                string
	StaticFileDirectory string
}

WebParameters are parameters for the Web subcommand.

Jump to

Keyboard shortcuts

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