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

package polluter

import "github.com/romanyx/polluter"


Package Files

json.go mysql.go polluter.go postgres.go redis.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 option enambles JSON parsing engine for seeding.

func YAMLParser Uses

func YAMLParser(p *polluter)

YAMLParser option 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 option enables MySQL engine for poluter.

func PostgresEngine Uses

func PostgresEngine(db *sql.DB) Option

PostgresEngine option enables Postgres engine for poluter.

func RedisEngine Uses

func RedisEngine(cli *redis.Client) Option

RedisEngine option enables Redis 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 11 packages (graph). Updated 2018-10-04. Refresh now. Tools for package owners.