func (c *NoopConnection) Query(query string, args []driver.Value) (driver.Rows, error) {
	if c.returnNilRows {
		c.returnNilRows = false
		return &NoopRows{pos: 1}, nil
	}
	return &NoopRows{}, nil
}
Query implements sql/driver.Conn
package gormexpect
import (
	"database/sql"
	"database/sql/driver"
	"fmt"
	"io"
	"sync"
	"github.com/jinzhu/gorm"
)
var pool *NoopDriver
func init() {
	pool = &NoopDriver{
		conns: make(map[string]*NoopConnection),
	}
	sql.Register("noop", pool)
}
type NoopDriver struct {
	sync.Mutex
	counter int
	conns   map[string]*NoopConnection
}
func (d *NoopDriver) Open(dsn string) (driver.Conn, error) {
	d.Lock()
	defer d.Unlock()
	c, ok := d.conns[dsn]
	if !ok {
		return c, fmt.Errorf("No connection available")
	}
	c.opened++
	return c, nil
}
type NoopResult struct {
	lastInsertID int64
	rowsAffected int64
}
func (r NoopResult) LastInsertId() (int64, error) {
	return r.lastInsertID, nil
}
func (r NoopResult) RowsAffected() (int64, error) {
	return r.rowsAffected, nil
}
type NoopRows struct {
	pos int
}
func (r *NoopRows) Columns() []string {
	return []string{"foo", "bar", "baz", "lol", "kek", "zzz"}
}
func (r *NoopRows) Close() error {
	return nil
}
func (r *NoopRows) Next(dest []driver.Value) error {
	if r.pos == 1 {
		return io.EOF
	}
	cols := []string{"foo", "bar", "baz", "lol", "kek", "zzz"}
	for i, col := range cols {
		dest[i] = col
	}
	r.pos++
	return nil
}
type NoopStmt struct{}
func (s *NoopStmt) Close() error {
	return nil
}
func (s *NoopStmt) NumInput() int {
	return 1
}
func (s *NoopStmt) Exec(args []driver.Value) (driver.Result, error) {
	return &NoopResult{}, nil
}
func (s *NoopStmt) Query(args []driver.Value) (driver.Rows, error) {
	return &NoopRows{}, nil
}
func NewNoopDB() (gorm.SQLCommon, NoopController, error) {
	pool.Lock()
	dsn := fmt.Sprintf("noop_db_%d", pool.counter)
	pool.counter++
	noop := &NoopConnection{nextExecResult: []int64{0, 0}, dsn: dsn, drv: pool}
	pool.conns[dsn] = noop
	pool.Unlock()
	db, err := noop.open()
	return db, noop, err
}
type NoopConnection struct {
	dsn            string
	drv            *NoopDriver
	opened         int
	returnNilRows  bool
	nextExecResult []int64
}
func (c *NoopConnection) open() (*sql.DB, error) {
	db, err := sql.Open("noop", c.dsn)
	if err != nil {
		return db, err
	}
	return db, db.Ping()
}
func (c *NoopConnection) Close() error {
	c.drv.Lock()
	defer c.drv.Unlock()
	c.opened--
	if c.opened == 0 {
		delete(c.drv.conns, c.dsn)
	}
	return nil
}
type NoopController interface {
	ReturnNilRows()
	ReturnExecResult(lastReturnedID, rowsAffected int64)
}
func (c *NoopConnection) Begin() (driver.Tx, error) {
	return c, nil
}
func (c *NoopConnection) Exec(query string, args []driver.Value) (driver.Result, error) {
	defer func() {
		c.nextExecResult = []int64{0, 0}
	}()
	return NoopResult{c.nextExecResult[0], c.nextExecResult[1]}, nil
}
func (c *NoopConnection) Prepare(query string) (driver.Stmt, error) {
	return &NoopStmt{}, nil
}