func (m *Mock) AddItem(body []byte, err error, isCount bool) {
	i := Item{
		Body:    body,
		Error:   err,
		IsCount: isCount,
	}
	m.mtx.Lock()
	m.Items = append(m.Items, i)
	m.mtx.Unlock()
}
AddItem on mock object
package mock
import (
	"bytes"
	"database/sql"
	"database/sql/driver"
	"fmt"
	"net/http"
	"net/url"
	"sync"
	"testing"
	"github.com/prest/adapters"
	"github.com/prest/adapters/scanner"
	"github.com/prest/config"
)
type Item struct {
	Body    []byte
	Error   error
	IsCount bool
}
type Mock struct {
	mtx   *sync.RWMutex
	t     *testing.T
	conns map[string]*mockConn
	Items []Item
}
func New(t *testing.T) (m *Mock) {
	m = &Mock{
		mtx: &sync.RWMutex{},
		t:   t,
	}
	drivers := sql.Drivers()
	for _, driver := range drivers {
		if driver == "mock" {
			return
		}
	}
	sql.Register("mock", m)
	return
}
func (m *Mock) Open(dsn string) (c driver.Conn, err error) {
	m.t.Helper()
	m.conns = make(map[string]*mockConn)
	m.conns["prest"] = &mockConn{}
	c, ok := m.conns[dsn]
	if !ok {
		return c, fmt.Errorf("expected a connection to be available, but it is not")
	}
	return
}
func (m *Mock) validate() {
	m.t.Helper()
	if len(m.Items) == 0 {
		m.t.Fatal("do not have any operations to perform")
	}
}
func (m *Mock) perform(query bool) (sc adapters.Scanner) {
	m.t.Helper()
	m.validate()
	m.mtx.Lock()
	item := m.Items[0]
	sc = &scanner.PrestScanner{
		Error:   item.Error,
		Buff:    bytes.NewBuffer(item.Body),
		IsQuery: query,
	}
	m.Items = m.Items[1:]
	m.mtx.Unlock()
	return
}
func (m *Mock) TablePermissions(table string, op string) (ok bool) {
	m.t.Helper()
	restrict := config.PrestConf.AccessConf.Restrict
	if !restrict {
		return true
	}
	tables := config.PrestConf.AccessConf.Tables
	for _, t := range tables {
		if t.Name == table {
			for _, p := range t.Permissions {
				if p == op {
					return true
				}
			}
		}
	}
	return false
}
func (m *Mock) GetScript(verb string, folder string, scriptName string) (script string, err error) {
	return
}
func (m *Mock) ParseScript(scriptPath string, queryURL url.Values) (sqlQuery string, values []interface{}, err error) {
	return
}
func (m *Mock) ExecuteScripts(method string, sql string, values []interface{}) (sc adapters.Scanner) {
	return
}
func (m *Mock) WhereByRequest(r *http.Request, initialPlaceholderID int) (whereSyntax string, values []interface{}, err error) {
	return
}
func (m *Mock) ReturningByRequest(r *http.Request) (ReturningSyntax string, err error) {
	return
}
func (m *Mock) DatabaseClause(req *http.Request) (query string, hasCount bool) {
	m.t.Helper()
	m.validate()
	m.mtx.Lock()
	hasCount = m.Items[0].IsCount
	m.mtx.Unlock()
	return
}
func (m *Mock) OrderByRequest(r *http.Request) (values string, err error) {
	return
}
func (m *Mock) PaginateIfPossible(r *http.Request) (paginatedQuery string, err error) {
	return
}
func (m *Mock) GetTransaction() (tx *sql.Tx, err error) {
	db, err := sql.Open("mock", "prest")
	if err != nil {
		return
	}
	return db.Begin()
}
func (m *Mock) Query(SQL string, params ...interface{}) (sc adapters.Scanner) {
	m.t.Helper()
	sc = m.perform(true)
	return
}
func (m *Mock) SchemaClause(req *http.Request) (query string, hasCount bool) {
	m.t.Helper()
	m.validate()
	m.mtx.Lock()
	hasCount = m.Items[0].IsCount
	m.mtx.Unlock()
	return
}
func (m *Mock) FieldsPermissions(r *http.Request, table string, op string) (fields []string, err error) {
	fields = append(fields, "mock")
	return
}
func (m *Mock) SelectFields(fields []string) (sql string, err error) {
	return
}
func (m *Mock) CountByRequest(req *http.Request) (countQuery string, err error) {
	return
}
func (m *Mock) JoinByRequest(r *http.Request) (values []string, err error) {
	return
}
func (m *Mock) GroupByClause(r *http.Request) (groupBySQL string) {
	return
}
func (m *Mock) QueryCount(SQL string, params ...interface{}) (sc adapters.Scanner) {
	m.t.Helper()
	sc = m.perform(false)
	return
}
func (m *Mock) ParseInsertRequest(r *http.Request) (colsName string, colsValue string, values []interface{}, err error) {
	return
}
func (m *Mock) Insert(SQL string, params ...interface{}) (sc adapters.Scanner) {
	m.t.Helper()
	sc = m.perform(false)
	return
}
func (m *Mock) InsertWithTransaction(tx *sql.Tx, SQL string, params ...interface{}) (sc adapters.Scanner) {
	m.t.Helper()
	sc = m.perform(false)
	return
}
func (m *Mock) Delete(SQL string, params ...interface{}) (sc adapters.Scanner) {
	m.t.Helper()
	sc = m.perform(false)
	return
}
func (m *Mock) DeleteWithTransaction(tx *sql.Tx, SQL string, params ...interface{}) (sc adapters.Scanner) {
	m.t.Helper()
	sc = m.perform(false)
	return
}
func (m *Mock) SetByRequest(r *http.Request, initialPlaceholderID int) (setSyntax string, values []interface{}, err error) {
	return
}
func (m *Mock) Update(SQL string, params ...interface{}) (sc adapters.Scanner) {
	m.t.Helper()
	sc = m.perform(false)
	return
}
func (m *Mock) UpdateWithTransaction(tx *sql.Tx, SQL string, params ...interface{}) (sc adapters.Scanner) {
	m.t.Helper()
	sc = m.perform(false)
	return
}
func (m *Mock) DistinctClause(r *http.Request) (distinctQuery string, err error) {
	return
}
func (m *Mock) SetDatabase(name string) {
}
func (m *Mock) SelectSQL(selectStr string, database string, schema string, table string) (s string) {
	return
}
func (m *Mock) InsertSQL(database string, schema string, table string, names string, placeholders string) (s string) {
	return
}
func (m *Mock) DeleteSQL(database string, schema string, table string) (s string) {
	return
}
func (m *Mock) UpdateSQL(database string, schema string, table string, setSyntax string) (s string) {
	return
}
func (m *Mock) DatabaseWhere(requestWhere string) (whereSyntax string) {
	return
}
func (m *Mock) DatabaseOrderBy(order string, hasCount bool) (orderBy string) {
	return
}
func (m *Mock) SchemaOrderBy(order string, hasCount bool) (orderBy string) {
	return
}
func (m *Mock) TableClause() (query string) {
	return
}
func (m *Mock) TableWhere(requestWhere string) (whereSyntax string) {
	return
}
func (m *Mock) TableOrderBy(order string) (orderBy string) {
	return
}
func (m *Mock) SchemaTablesClause() (query string) {
	return
}
func (m *Mock) SchemaTablesWhere(requestWhere string) (whereSyntax string) {
	return
}
func (m *Mock) SchemaTablesOrderBy(order string) (orderBy string) {
	return
}
func (m *Mock) ParseBatchInsertRequest(r *http.Request) (colsName string, placeholders string, values []interface{}, err error) {
	return
}
func (m *Mock) BatchInsertValues(SQL string, params ...interface{}) (sc adapters.Scanner) {
	m.t.Helper()
	sc = m.perform(true)
	return
}
func (m *Mock) BatchInsertCopy(dbname, schema, table string, keys []string, values ...interface{}) (sc adapters.Scanner) {
	m.t.Helper()
	sc = m.perform(false)
	return
}