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

package polluter

import "github.com/romanyx/polluter"

Index

Package Files

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

Variables

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 Polluter.

func RedisEngine Uses

func RedisEngine(cli *redis.Client) Option

RedisEngine option enables Redis engine for Polluter.

type Polluter Uses

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

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)

func (*Polluter) Pollute Uses

func (p *Polluter) Pollute(r io.Reader) error

Pollute parses input from the reader and tries to exec generated commands on a database. Use New factory function to generate.

Package polluter imports 11 packages (graph). Updated 2018-11-26. Refresh now. Tools for package owners.