postgres

package
v0.0.0-...-2f503fb Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database struct {
	DB        *pg.DB
	Tables    map[string]*model.Dataset
	BatchSize int
}

Database is a struct representing a full logical database.

func NewDatabase

func NewDatabase(config *conf.Conf) (*Database, error)

NewDatabase creates a new database instance.

func (*Database) AddWordStems

func (d *Database) AddWordStems(data []string) error

AddWordStems builds the word stemming lookup in the database.

func (*Database) CreateResultTable

func (d *Database) CreateResultTable(tableName string) error

CreateResultTable creates an empty table for the solution results.

func (*Database) CreateSolutionMetadataTables

func (d *Database) CreateSolutionMetadataTables() error

CreateSolutionMetadataTables creates an empty table for the solution results.

func (*Database) DeleteDataset

func (d *Database) DeleteDataset(name string)

DeleteDataset deletes all tables & views for a dataset.

func (*Database) DropTable

func (d *Database) DropTable(tableName string) error

DropTable drops the specified table from the database.

func (*Database) DropView

func (d *Database) DropView(viewName string) error

DropView drops the specified view from the database.

func (*Database) IngestRow

func (d *Database) IngestRow(tableName string, data []string) error

IngestRow parses the raw csv data and stores it to the table specified. The previously parsed metadata is used to map columns.

func (*Database) InitializeDataset

func (d *Database) InitializeDataset(meta *api.Metadata) (*model.Dataset, error)

InitializeDataset initializes the dataset with the provided metadata.

func (*Database) InitializeTable

func (d *Database) InitializeTable(tableName string, ds *model.Dataset) error

InitializeTable generates and runs a table create statement based on the schema.

func (*Database) InsertRemainingRows

func (d *Database) InsertRemainingRows() error

InsertRemainingRows empties all batches and inserts the data to the database.

func (*Database) StoreMetadata

func (d *Database) StoreMetadata(tableName string) error

StoreMetadata stores the variable information to the specified table.

type WordStem

type WordStem struct {
	Word string
	Stem string
}

WordStem contains the pairing of a word and its stemmed version.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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