func (this *Iter_UServ_CreateUsersTable) Zero() error {
	row, ok := this.Next()
	if row != nil && row.err != nil && row.err != io.EOF {
		return row.err
	}
	if ok {
		return fmt.Errorf("expected exactly 0 results from query 'CreateUsersTable'")
	}
	return nil
}
Zero returns an error if there were any rows in the result
package pb
import (
	sql "database/sql"
	driver "database/sql/driver"
	fmt "fmt"
	io "io"
	proto "github.com/golang/protobuf/proto"
	timestamp "github.com/golang/protobuf/ptypes/timestamp"
	imports "github.com/tcncloud/protoc-gen-persistexamples/user_sql/pb/imports"
	persist "github.com/tcncloud/protoc-gen-persist/persist"
	context "golang.org/x/net/context"
	codes "google.golang.org/grpc/codes"
	gstatus "google.golang.org/grpc/status"
)
type Queries_UServ struct {
	opts Opts_UServ
}
func QueriesUServ(opts ...Opts_UServ) *Queries_UServ {
	var myOpts Opts_UServ
	if len(opts) > 0 {
		myOpts = opts[0]
	} else {
		myOpts = OptsUServ(&DefaultHooks_UServ{}, &DefaultTypeMappings_UServ{})
	}
	return &Queries_UServ{
		opts: myOpts,
	}
}
func (this *Queries_UServ) CreateUsersTable(ctx context.Context, db persist.Runnable) *Query_UServ_CreateUsersTable {
	return &Query_UServ_CreateUsersTable{
		opts: this.opts,
		ctx:  ctx,
		db:   db,
	}
}
type Query_UServ_CreateUsersTable struct {
	opts Opts_UServ
	db   persist.Runnable
	ctx  context.Context
}
func (this *Query_UServ_CreateUsersTable) QueryInType_Empty()  {}
func (this *Query_UServ_CreateUsersTable) QueryOutType_Empty() {}
func (this *Query_UServ_CreateUsersTable) Execute(x In_UServ_CreateUsersTable) *Iter_UServ_CreateUsersTable {
	var setupErr error
	params := []interface{}{}
	result := &Iter_UServ_CreateUsersTable{
		tm:  this.opts.MAPPINGS,
		ctx: this.ctx,
	}
	if setupErr != nil {
		result.err = setupErr
		return result
	}
	result.result, result.err = this.db.ExecContext(this.ctx, "CREATE TABLE users(id integer PRIMARY KEY, name VARCHAR(50), friends BYTEA, created_on VARCHAR(50), id2 SMALLINT, counts BIGINT[])", params...)
	return result
}
func (this *Queries_UServ) InsertUsers(ctx context.Context, db persist.Runnable) *Query_UServ_InsertUsers {
	return &Query_UServ_InsertUsers{
		opts: this.opts,
		ctx:  ctx,
		db:   db,
	}
}
type Query_UServ_InsertUsers struct {
	opts Opts_UServ
	db   persist.Runnable
	ctx  context.Context
}
func (this *Query_UServ_InsertUsers) QueryInType_User()   {}
func (this *Query_UServ_InsertUsers) QueryOutType_Empty() {}
func (this *Query_UServ_InsertUsers) Execute(x In_UServ_InsertUsers) *Iter_UServ_InsertUsers {
	var setupErr error
	params := []interface{}{
		func() (out interface{}) {
			out = x.GetId()
			return
		}(),
		func() (out interface{}) {
			out = x.GetName()
			return
		}(),
		func() (out interface{}) {
			raw, err := proto.Marshal(x.GetFriends())
			if err != nil {
				setupErr = err
			}
			out = raw
			return
		}(),
		func() (out interface{}) {
			mapper := this.opts.MAPPINGS.TimestampTimestamp()
			out = mapper.ToSql(x.GetCreatedOn())
			return
		}(),
		func() (out interface{}) {
			out = x.GetId2()
			return
		}(),
		func() (out interface{}) {
			mapper := this.opts.MAPPINGS.Int64Slice()
			out = mapper.ToSql(x.GetCounts())
			return
		}(),
	}
	result := &Iter_UServ_InsertUsers{
		tm:  this.opts.MAPPINGS,
		ctx: this.ctx,
	}
	if setupErr != nil {
		result.err = setupErr
		return result
	}
	result.result, result.err = this.db.ExecContext(this.ctx, "INSERT INTO users (id, name, friends, created_on, id2, counts) VALUES ($1, $2, $3, $4, $5, $6)", params...)
	return result
}
func (this *Queries_UServ) GetAllUsers(ctx context.Context, db persist.Runnable) *Query_UServ_GetAllUsers {
	return &Query_UServ_GetAllUsers{
		opts: this.opts,
		ctx:  ctx,
		db:   db,
	}
}
type Query_UServ_GetAllUsers struct {
	opts Opts_UServ
	db   persist.Runnable
	ctx  context.Context
}
func (this *Query_UServ_GetAllUsers) QueryInType_Empty() {}
func (this *Query_UServ_GetAllUsers) QueryOutType_User() {}
func (this *Query_UServ_GetAllUsers) Execute(x In_UServ_GetAllUsers) *Iter_UServ_GetAllUsers {
	var setupErr error
	params := []interface{}{}
	result := &Iter_UServ_GetAllUsers{
		tm:  this.opts.MAPPINGS,
		ctx: this.ctx,
	}
	if setupErr != nil {
		result.err = setupErr
		return result
	}
	result.rows, result.err = this.db.QueryContext(this.ctx, "SELECT id, name, friends, created_on, id2 FROM users", params...)
	return result
}
func (this *Queries_UServ) SelectUserById(ctx context.Context, db persist.Runnable) *Query_UServ_SelectUserById {
	return &Query_UServ_SelectUserById{
		opts: this.opts,
		ctx:  ctx,
		db:   db,
	}
}
type Query_UServ_SelectUserById struct {
	opts Opts_UServ
	db   persist.Runnable
	ctx  context.Context
}
func (this *Query_UServ_SelectUserById) QueryInType_User()  {}
func (this *Query_UServ_SelectUserById) QueryOutType_User() {}
func (this *Query_UServ_SelectUserById) Execute(x In_UServ_SelectUserById) *Iter_UServ_SelectUserById {
	var setupErr error
	params := []interface{}{
		func() (out interface{}) {
			out = x.GetId()
			return
		}(),
	}
	result := &Iter_UServ_SelectUserById{
		tm:  this.opts.MAPPINGS,
		ctx: this.ctx,
	}
	if setupErr != nil {
		result.err = setupErr
		return result
	}
	result.rows, result.err = this.db.QueryContext(this.ctx, "SELECT id, name, friends, created_on, id2 FROM users WHERE id = $1", params...)
	return result
}
func (this *Queries_UServ) UpdateUserName(ctx context.Context, db persist.Runnable) *Query_UServ_UpdateUserName {
	return &Query_UServ_UpdateUserName{
		opts: this.opts,
		ctx:  ctx,
		db:   db,
	}
}
type Query_UServ_UpdateUserName struct {
	opts Opts_UServ
	db   persist.Runnable
	ctx  context.Context
}
func (this *Query_UServ_UpdateUserName) QueryInType_User()  {}
func (this *Query_UServ_UpdateUserName) QueryOutType_User() {}
func (this *Query_UServ_UpdateUserName) Execute(x In_UServ_UpdateUserName) *Iter_UServ_UpdateUserName {
	var setupErr error
	params := []interface{}{
		func() (out interface{}) {
			out = x.GetName()
			return
		}(),
		func() (out interface{}) {
			out = x.GetId()
			return
		}(),
	}
	result := &Iter_UServ_UpdateUserName{
		tm:  this.opts.MAPPINGS,
		ctx: this.ctx,
	}
	if setupErr != nil {
		result.err = setupErr
		return result
	}
	result.rows, result.err = this.db.QueryContext(this.ctx, "Update users set name = $1 WHERE id = $2  RETURNING id, name, friends, created_on", params...)
	return result
}
func (this *Queries_UServ) UpdateNameToFoo(ctx context.Context, db persist.Runnable) *Query_UServ_UpdateNameToFoo {
	return &Query_UServ_UpdateNameToFoo{
		opts: this.opts,
		ctx:  ctx,
		db:   db,
	}
}
type Query_UServ_UpdateNameToFoo struct {
	opts Opts_UServ
	db   persist.Runnable
	ctx  context.Context
}
func (this *Query_UServ_UpdateNameToFoo) QueryInType_User()   {}
func (this *Query_UServ_UpdateNameToFoo) QueryOutType_Empty() {}
func (this *Query_UServ_UpdateNameToFoo) Execute(x In_UServ_UpdateNameToFoo) *Iter_UServ_UpdateNameToFoo {
	var setupErr error
	params := []interface{}{
		func() (out interface{}) {
			out = x.GetId()
			return
		}(),
	}
	result := &Iter_UServ_UpdateNameToFoo{
		tm:  this.opts.MAPPINGS,
		ctx: this.ctx,
	}
	if setupErr != nil {
		result.err = setupErr
		return result
	}
	result.result, result.err = this.db.ExecContext(this.ctx, "Update users set name = 'foo' WHERE id = $1", params...)
	return result
}
func (this *Queries_UServ) GetFriends(ctx context.Context, db persist.Runnable) *Query_UServ_GetFriends {
	return &Query_UServ_GetFriends{
		opts: this.opts,
		ctx:  ctx,
		db:   db,
	}
}
type Query_UServ_GetFriends struct {
	opts Opts_UServ
	db   persist.Runnable
	ctx  context.Context
}
func (this *Query_UServ_GetFriends) QueryInType_FriendsReq() {}
func (this *Query_UServ_GetFriends) QueryOutType_User()      {}
func (this *Query_UServ_GetFriends) Execute(x In_UServ_GetFriends) *Iter_UServ_GetFriends {
	var setupErr error
	params := []interface{}{
		func() (out interface{}) {
			mapper := this.opts.MAPPINGS.SliceStringParam()
			out = mapper.ToSql(x.GetNames())
			return
		}(),
	}
	result := &Iter_UServ_GetFriends{
		tm:  this.opts.MAPPINGS,
		ctx: this.ctx,
	}
	if setupErr != nil {
		result.err = setupErr
		return result
	}
	result.rows, result.err = this.db.QueryContext(this.ctx, "SELECT id, name, friends, created_on, id2 FROM users WHERE name = ANY($1)", params...)
	return result
}
func (this *Queries_UServ) Drop(ctx context.Context, db persist.Runnable) *Query_UServ_Drop {
	return &Query_UServ_Drop{
		opts: this.opts,
		ctx:  ctx,
		db:   db,
	}
}
type Query_UServ_Drop struct {
	opts Opts_UServ
	db   persist.Runnable
	ctx  context.Context
}
func (this *Query_UServ_Drop) QueryInType_Empty()  {}
func (this *Query_UServ_Drop) QueryOutType_Empty() {}
func (this *Query_UServ_Drop) Execute(x In_UServ_Drop) *Iter_UServ_Drop {
	var setupErr error
	params := []interface{}{}
	result := &Iter_UServ_Drop{
		tm:  this.opts.MAPPINGS,
		ctx: this.ctx,
	}
	if setupErr != nil {
		result.err = setupErr
		return result
	}
	result.result, result.err = this.db.ExecContext(this.ctx, "drop table users", params...)
	return result
}
type Iter_UServ_CreateUsersTable struct {
	result sql.Result
	rows   *sql.Rows
	err    error
	tm     TypeMappings_UServ
	ctx    context.Context
}
func (this *Iter_UServ_CreateUsersTable) IterOutTypeEmpty() {}
func (this *Iter_UServ_CreateUsersTable) IterInTypeEmpty()  {}
func (this *Iter_UServ_CreateUsersTable) Each(fun func(*Row_UServ_CreateUsersTable) error) error {
	defer func() {
		if this.rows != nil {
			this.rows.Close()
		}
	}()
	for {
		select {
		case <-this.ctx.Done():
			return this.ctx.Err()
		default:
			if row, ok := this.Next(); !ok {
				return nil
			} else if err := fun(row); err != nil {
				return err
			}
		}
	}
}
func (this *Iter_UServ_CreateUsersTable) One() *Row_UServ_CreateUsersTable {
	first, hasFirst := this.Next()
	defer func() {
		if this.rows != nil {
			this.rows.Close()
		}
	}()
	if first != nil && first.err != nil && first.err != io.EOF {
		return &Row_UServ_CreateUsersTable{err: first.err}
	}
	_, hasSecond := this.Next()
	if !hasFirst || hasSecond {
		amount := "none"
		if hasSecond {
			amount = "multiple"
		}
		return &Row_UServ_CreateUsersTable{err: persist.NotFound{Msg: fmt.Sprintf("expected exactly 1 result from query 'CreateUsersTable' found %s", amount)}}
	}
	return first
}