polluter: github.com/romanyx/polluter Index | Files

package polluter

import "github.com/romanyx/polluter"


Package Files

json.go mysql.go polluter.go postgres.go yaml.go


var (
    // ErrEngineNotSpecified causes if no engine option was used
    // with the factory method.
    ErrEngineNotSpecified = errors.New("specify database engine with the factory method option")

func JSONParser Uses

func JSONParser(p *polluter)

JSONParser options enambles JSON parsing engine for seeding.

func YAMLParser Uses

func YAMLParser(p *polluter)

YAMLParser options enambles YAML parsing engine for seeding.

type Option Uses

type Option func(*polluter)

Option defines options for polluter.

func MySQLEngine Uses

func MySQLEngine(db *sql.DB) Option

MySQLEngine options enables MySQL engine for poluter.

func PostgresEngine Uses

func PostgresEngine(db *sql.DB) Option

PostgresEngine options enables Postgres engine for poluter.

type Polluter Uses

type Polluter interface {
    Pollute(io.Reader) error

Polluter pollutes database with given input.

func New Uses

func New(options ...Option) Polluter

New factory method returns initialized Polluter. For example to seed MySQL database with JSON input use:

p := New(MySQLEngine(db))

To seed Postgres database with YAML input use:

p := New(PostgresEngine(db), YAMLParser)

Package polluter imports 8 packages (graph). Updated 2018-06-18. Refresh now. Tools for package owners.