func rollback(tx nero.Tx, err error) error {
	rerr := tx.Rollback()
	if rerr != nil {
		err = errors.Wrapf(err, "rollback error: %v", rerr)
	}
	return err
}
rollback performs a rollback
package playerrepo
import (
	"context"
	"reflect"
	"time"
	multierror "github.com/hashicorp/go-multierror"
	"github.com/pkg/errors"
	"github.com/sf9v/nero"
	"github.com/sf9v/nero/aggregate"
	"github.com/sf9v/nero/comparison"
	"github.com/sf9v/nero/sort"
	"github.com/sf9v/nero/test/integration/player"
)
type Repository interface {
	BeginTx(context.Context) (nero.Tx, error)
	Create(context.Context, *Creator) (id string, err error)
	CreateInTx(context.Context, nero.Tx, *Creator) (id string, err error)
	CreateMany(context.Context, ...*Creator) error
	CreateManyInTx(context.Context, nero.Tx, ...*Creator) error
	Query(context.Context, *Queryer) ([]*player.Player, error)
	QueryInTx(context.Context, nero.Tx, *Queryer) ([]*player.Player, error)
	QueryOne(context.Context, *Queryer) (*player.Player, error)
	QueryOneInTx(context.Context, nero.Tx, *Queryer) (*player.Player, error)
	Update(context.Context, *Updater) (rowsAffected int64, err error)
	UpdateInTx(context.Context, nero.Tx, *Updater) (rowsAffected int64, err error)
	Delete(context.Context, *Deleter) (rowsAffected int64, err error)
	DeleteInTx(context.Context, nero.Tx, *Deleter) (rowsAffected int64, err error)
	Aggregate(context.Context, *Aggregator) error
	AggregateInTx(context.Context, nero.Tx, *Aggregator) error
}
type Creator struct {
	email     string
	name      string
	age       int
	race      player.Race
	updatedAt *time.Time
}
func NewCreator() *Creator {
	return &Creator{}
}
func (c *Creator) Email(email string) *Creator {
	c.email = email
	return c
}
func (c *Creator) Name(name string) *Creator {
	c.name = name
	return c
}
func (c *Creator) Age(age int) *Creator {
	c.age = age
	return c
}
func (c *Creator) Race(race player.Race) *Creator {
	c.race = race
	return c
}
func (c *Creator) UpdatedAt(updatedAt *time.Time) *Creator {
	c.updatedAt = updatedAt
	return c
}
func (c *Creator) Validate() error {
	var err error
	if isZero(c.email) {
		err = multierror.Append(err, nero.NewErrRequiredField("email"))
	}
	if isZero(c.name) {
		err = multierror.Append(err, nero.NewErrRequiredField("name"))
	}
	if isZero(c.age) {
		err = multierror.Append(err, nero.NewErrRequiredField("age"))
	}
	if isZero(c.race) {
		err = multierror.Append(err, nero.NewErrRequiredField("race"))
	}
	return err
}
type Queryer struct {
	limit     uint
	offset    uint
	predFuncs []comparison.PredFunc
	sortFuncs []sort.SortFunc
}
func NewQueryer() *Queryer {
	return &Queryer{}
}
func (q *Queryer) Where(predFuncs ...comparison.PredFunc) *Queryer {
	q.predFuncs = append(q.predFuncs, predFuncs...)
	return q
}
func (q *Queryer) Sort(sortFuncs ...sort.SortFunc) *Queryer {
	q.sortFuncs = append(q.sortFuncs, sortFuncs...)
	return q
}
func (q *Queryer) Limit(limit uint) *Queryer {
	q.limit = limit
	return q
}
func (q *Queryer) Offset(offset uint) *Queryer {
	q.offset = offset
	return q
}
type Updater struct {
	email     string
	name      string
	age       int
	race      player.Race
	updatedAt *time.Time
	predFuncs []comparison.PredFunc
}
func NewUpdater() *Updater {
	return &Updater{}
}
func (c *Updater) Email(email string) *Updater {
	c.email = email
	return c
}
func (c *Updater) Name(name string) *Updater {
	c.name = name
	return c
}
func (c *Updater) Age(age int) *Updater {
	c.age = age
	return c
}
func (c *Updater) Race(race player.Race) *Updater {
	c.race = race
	return c
}
func (c *Updater) UpdatedAt(updatedAt *time.Time) *Updater {
	c.updatedAt = updatedAt
	return c
}
func (u *Updater) Where(predFuncs ...comparison.PredFunc) *Updater {
	u.predFuncs = append(u.predFuncs, predFuncs...)
	return u
}
type Deleter struct {
	predFuncs []comparison.PredFunc
}
func NewDeleter() *Deleter {
	return &Deleter{}
}
func (d *Deleter) Where(predFuncs ...comparison.PredFunc) *Deleter {
	d.predFuncs = append(d.predFuncs, predFuncs...)
	return d
}
type Aggregator struct {
	v         interface{}
	aggFuncs  []aggregate.AggFunc
	predFuncs []comparison.PredFunc
	sortFuncs []sort.SortFunc
	groupBys  []Field
}
func NewAggregator(v interface{}) *Aggregator {
	return &Aggregator{v: v}
}
func (a *Aggregator) Aggregate(aggFuncs ...aggregate.AggFunc) *Aggregator {
	a.aggFuncs = append(a.aggFuncs, aggFuncs...)
	return a
}
func (a *Aggregator) Where(predFuncs ...comparison.PredFunc) *Aggregator {
	a.predFuncs = append(a.predFuncs, predFuncs...)
	return a
}
func (a *Aggregator) Sort(sortFuncs ...sort.SortFunc) *Aggregator {
	a.sortFuncs = append(a.sortFuncs, sortFuncs...)
	return a
}
func (a *Aggregator) GroupBy(fields ...Field) *Aggregator {
	a.groupBys = append(a.groupBys, fields...)
	return a
}