func (this *Iter_UServ_SelectUserById) Each(fun func(*Row_UServ_SelectUserById) error) error {
	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
			}
		}
	}
}
Each performs 'fun' on each row in the result set.
Each respects the context passed to it.
It will stop iteration, and returns this.ctx.Err() if encountered.
package pb
import (
	fmt "fmt"
	io "io"
	spanner "cloud.google.com/go/spanner"
	proto "github.com/golang/protobuf/proto"
	timestamp "github.com/golang/protobuf/ptypes/timestamp"
	persist "github.com/tcncloud/protoc-gen-persist/persist"
	context "golang.org/x/net/context"
	iterator "google.golang.org/api/iterator"
	codes "google.golang.org/grpc/codes"
	gstatus "google.golang.org/grpc/status"
)
type Result interface {
	LastInsertId() (int64, error)
	RowsAffected() (int64, error)
}
type SpannerResult struct {
	iter *spanner.RowIterator
}
func (sr *SpannerResult) LastInsertId() (int64, error) {
	return -1, nil
}
func (sr *SpannerResult) RowsAffected() (int64, error) {
	return sr.iter.RowCount, nil
}
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.SpannerRunnable) *Query_UServ_CreateUsersTable {
	return &Query_UServ_CreateUsersTable{
		opts: this.opts,
		ctx:  ctx,
		db:   db,
	}
}
type Query_UServ_CreateUsersTable struct {
	opts Opts_UServ
	db   persist.SpannerRunnable
	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 {
	ctx := this.ctx
	result := &Iter_UServ_CreateUsersTable{
		result: &SpannerResult{},
		tm:     this.opts.MAPPINGS,
		ctx:    ctx,
	}
	params, err := func() (map[string]interface{}, error) {
		result := make(map[string]interface{})
		return result, nil
	}()
	if err != nil {
		result.err = err
		return result
	}
	iter := this.db.QueryWithStats(ctx, spanner.Statement{
		SQL:    "CREATE TABLE users(id integer PRIMARY KEY, name VARCHAR(50), friends BYTEA, created_on VARCHAR(50))",
		Params: params,
	})
	result.rows = iter
	result.err = err
	return result
}
func (this *Queries_UServ) InsertUsers(ctx context.Context, db persist.SpannerRunnable) *Query_UServ_InsertUsers {
	return &Query_UServ_InsertUsers{
		opts: this.opts,
		ctx:  ctx,
		db:   db,
	}
}
type Query_UServ_InsertUsers struct {
	opts Opts_UServ
	db   persist.SpannerRunnable
	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 {
	ctx := this.ctx
	result := &Iter_UServ_InsertUsers{
		result: &SpannerResult{},
		tm:     this.opts.MAPPINGS,
		ctx:    ctx,
	}
	params, err := func() (map[string]interface{}, error) {
		result := make(map[string]interface{})
		result["id"] = x.GetId()
		result["name"] = x.GetName()
		friends, err := proto.Marshal(x.GetFriends())
		if err != nil {
			return nil, err
		}
		result["friends"] = friends
		created_on, err := this.opts.MAPPINGS.TimestampTimestamp().ToSpanner(x.GetCreatedOn()).SpannerValue()
		if err != nil {
			return nil, err
		}
		result["created_on"] = created_on
		return result, nil
	}()
	if err != nil {
		result.err = err
		return result
	}
	iter := this.db.QueryWithStats(ctx, spanner.Statement{
		SQL:    "INSERT INTO users (id, name, friends, created_on) VALUES (@id, @name, @friends, @created_on)",
		Params: params,
	})
	result.rows = iter
	result.err = err
	return result
}
func (this *Queries_UServ) GetAllUsers(ctx context.Context, db persist.SpannerRunnable) *Query_UServ_GetAllUsers {
	return &Query_UServ_GetAllUsers{
		opts: this.opts,
		ctx:  ctx,
		db:   db,
	}
}
type Query_UServ_GetAllUsers struct {
	opts Opts_UServ
	db   persist.SpannerRunnable
	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 {
	ctx := this.ctx
	result := &Iter_UServ_GetAllUsers{
		result: &SpannerResult{},
		tm:     this.opts.MAPPINGS,
		ctx:    ctx,
	}
	params, err := func() (map[string]interface{}, error) {
		result := make(map[string]interface{})
		return result, nil
	}()
	if err != nil {
		result.err = err
		return result
	}
	iter := this.db.QueryWithStats(ctx, spanner.Statement{
		SQL:    "SELECT id, name, friends, created_on FROM users",
		Params: params,
	})
	result.rows = iter
	result.err = err
	return result
}
func (this *Queries_UServ) SelectUserById(ctx context.Context, db persist.SpannerRunnable) *Query_UServ_SelectUserById {
	return &Query_UServ_SelectUserById{
		opts: this.opts,
		ctx:  ctx,
		db:   db,
	}
}
type Query_UServ_SelectUserById struct {
	opts Opts_UServ
	db   persist.SpannerRunnable
	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 {
	ctx := this.ctx
	result := &Iter_UServ_SelectUserById{
		result: &SpannerResult{},
		tm:     this.opts.MAPPINGS,
		ctx:    ctx,
	}
	params, err := func() (map[string]interface{}, error) {
		result := make(map[string]interface{})
		result["id"] = x.GetId()
		return result, nil
	}()
	if err != nil {
		result.err = err
		return result
	}
	iter := this.db.QueryWithStats(ctx, spanner.Statement{
		SQL:    "SELECT id, name, friends, created_on FROM users WHERE id = @id",
		Params: params,
	})
	result.rows = iter
	result.err = err
	return result
}
func (this *Queries_UServ) UpdateUserName(ctx context.Context, db persist.SpannerRunnable) *Query_UServ_UpdateUserName {
	return &Query_UServ_UpdateUserName{
		opts: this.opts,
		ctx:  ctx,
		db:   db,
	}
}
type Query_UServ_UpdateUserName struct {
	opts Opts_UServ
	db   persist.SpannerRunnable
	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 {
	ctx := this.ctx
	result := &Iter_UServ_UpdateUserName{
		result: &SpannerResult{},
		tm:     this.opts.MAPPINGS,
		ctx:    ctx,
	}
	params, err := func() (map[string]interface{}, error) {
		result := make(map[string]interface{})
		result["name"] = x.GetName()
		result["id"] = x.GetId()
		return result, nil
	}()
	if err != nil {
		result.err = err
		return result
	}
	iter := this.db.QueryWithStats(ctx, spanner.Statement{
		SQL:    "UPDATE users SET name = @name WHERE id = @id ",
		Params: params,
	})
	result.rows = iter
	result.err = err
	return result
}
func (this *Queries_UServ) UpdateNameToFoo(ctx context.Context, db persist.SpannerRunnable) *Query_UServ_UpdateNameToFoo {
	return &Query_UServ_UpdateNameToFoo{
		opts: this.opts,
		ctx:  ctx,
		db:   db,
	}
}
type Query_UServ_UpdateNameToFoo struct {
	opts Opts_UServ
	db   persist.SpannerRunnable
	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 {
	ctx := this.ctx
	result := &Iter_UServ_UpdateNameToFoo{
		result: &SpannerResult{},
		tm:     this.opts.MAPPINGS,
		ctx:    ctx,
	}
	params, err := func() (map[string]interface{}, error) {
		result := make(map[string]interface{})
		result["id"] = x.GetId()
		return result, nil
	}()
	if err != nil {
		result.err = err
		return result
	}
	iter := this.db.QueryWithStats(ctx, spanner.Statement{
		SQL:    "UPDATE users SET name = 'foo' WHERE id = @id",
		Params: params,
	})
	result.rows = iter
	result.err = err
	return result
}
func (this *Queries_UServ) GetFriends(ctx context.Context, db persist.SpannerRunnable) *Query_UServ_GetFriends {
	return &Query_UServ_GetFriends{
		opts: this.opts,
		ctx:  ctx,
		db:   db,
	}
}
type Query_UServ_GetFriends struct {
	opts Opts_UServ
	db   persist.SpannerRunnable
	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 {
	ctx := this.ctx
	result := &Iter_UServ_GetFriends{
		result: &SpannerResult{},
		tm:     this.opts.MAPPINGS,
		ctx:    ctx,
	}
	params, err := func() (map[string]interface{}, error) {
		result := make(map[string]interface{})
		names, err := this.opts.MAPPINGS.SliceStringParam().ToSpanner(x.GetNames()).SpannerValue()
		if err != nil {
			return nil, err
		}
		result["names"] = names
		return result, nil
	}()
	if err != nil {
		result.err = err
		return result
	}
	iter := this.db.QueryWithStats(ctx, spanner.Statement{
		SQL:    "SELECT id, name, friends, created_on  FROM users WHERE name IN UNNEST(@names)",
		Params: params,
	})
	result.rows = iter
	result.err = err
	return result
}
func (this *Queries_UServ) Drop(ctx context.Context, db persist.SpannerRunnable) *Query_UServ_Drop {
	return &Query_UServ_Drop{
		opts: this.opts,
		ctx:  ctx,
		db:   db,
	}
}
type Query_UServ_Drop struct {
	opts Opts_UServ
	db   persist.SpannerRunnable
	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 {
	ctx := this.ctx
	result := &Iter_UServ_Drop{
		result: &SpannerResult{},
		tm:     this.opts.MAPPINGS,
		ctx:    ctx,
	}
	params, err := func() (map[string]interface{}, error) {
		result := make(map[string]interface{})
		return result, nil
	}()
	if err != nil {
		result.err = err
		return result
	}
	iter := this.db.QueryWithStats(ctx, spanner.Statement{
		SQL:    "drop table users",
		Params: params,
	})
	result.rows = iter
	result.err = err
	return result
}
type Iter_UServ_CreateUsersTable struct {
	result *SpannerResult
	rows   *spanner.RowIterator
	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 {
	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()
	if first != nil && first.err != nil {
		return &Row_UServ_CreateUsersTable{err: first.err}
	}
	_, hasSecond := this.Next()
	if !hasFirst || hasSecond {
		amount := "none"
		if hasSecond {
			amount = "multiple"
		}
		return &Row_UServ_CreateUsersTable{err: fmt.Errorf("expected exactly 1 result from query 'CreateUsersTable' found %s", amount)}
	}
	return first
}
func (this *Iter_UServ_CreateUsersTable) Zero() error {
	row, ok := this.Next()
	if row != nil && row.err != nil {
		return row.err
	}
	if ok {
		return fmt.Errorf("expected exactly 0 results from query 'CreateUsersTable'")
	}
	return nil
}
func (this *Iter_UServ_CreateUsersTable) Next() (*Row_UServ_CreateUsersTable, bool) {
	row, err := this.rows.Next()
	_ = row
	if err == iterator.Done {
		return nil, false
	}
	if err != nil {
		return &Row_UServ_CreateUsersTable{err: err}, true
	}
	res := &Empty{}
	return &Row_UServ_CreateUsersTable{item: res}, true
}
func (this *Iter_UServ_CreateUsersTable) Slice() []*Row_UServ_CreateUsersTable {
	var results []*Row_UServ_CreateUsersTable
	for {
		if i, ok := this.Next(); ok {
			results = append(results, i)
		} else {
			break
		}
	}
	return results
}
type Iter_UServ_InsertUsers struct {
	result *SpannerResult
	rows   *spanner.RowIterator
	err    error
	tm     TypeMappings_UServ
	ctx    context.Context
}
func (this *Iter_UServ_InsertUsers) IterOutTypeEmpty() {}
func (this *Iter_UServ_InsertUsers) IterInTypeUser()   {}
func (this *Iter_UServ_InsertUsers) Each(fun func(*Row_UServ_InsertUsers) error) error {
	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_InsertUsers) One() *Row_UServ_InsertUsers {
	first, hasFirst := this.Next()
	if first != nil && first.err != nil {
		return &Row_UServ_InsertUsers{err: first.err}
	}
	_, hasSecond := this.Next()
	if !hasFirst || hasSecond {
		amount := "none"
		if hasSecond {
			amount = "multiple"
		}
		return &Row_UServ_InsertUsers{err: fmt.Errorf("expected exactly 1 result from query 'InsertUsers' found %s", amount)}
	}
	return first
}
func (this *Iter_UServ_InsertUsers) Zero() error {
	row, ok := this.Next()
	if row != nil && row.err != nil {
		return row.err
	}
	if ok {
		return fmt.Errorf("expected exactly 0 results from query 'InsertUsers'")
	}
	return nil
}
func (this *Iter_UServ_InsertUsers) Next() (*Row_UServ_InsertUsers, bool) {
	row, err := this.rows.Next()
	_ = row
	if err == iterator.Done {
		return nil, false
	}
	if err != nil {
		return &Row_UServ_InsertUsers{err: err}, true
	}
	res := &Empty{}
	return &Row_UServ_InsertUsers{item: res}, true
}
func (this *Iter_UServ_InsertUsers) Slice() []*Row_UServ_InsertUsers {
	var results []*Row_UServ_InsertUsers
	for {
		if i, ok := this.Next(); ok {
			results = append(results, i)
		} else {
			break
		}
	}
	return results
}
type Iter_UServ_GetAllUsers struct {
	result *SpannerResult
	rows   *spanner.RowIterator
	err    error
	tm     TypeMappings_UServ
	ctx    context.Context
}
func (this *Iter_UServ_GetAllUsers) IterOutTypeUser() {}
func (this *Iter_UServ_GetAllUsers) IterInTypeEmpty() {}
func (this *Iter_UServ_GetAllUsers) Each(fun func(*Row_UServ_GetAllUsers) error) error {
	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_GetAllUsers) One() *Row_UServ_GetAllUsers {
	first, hasFirst := this.Next()
	if first != nil && first.err != nil {
		return &Row_UServ_GetAllUsers{err: first.err}
	}
	_, hasSecond := this.Next()
	if !hasFirst || hasSecond {
		amount := "none"
		if hasSecond {
			amount = "multiple"
		}
		return &Row_UServ_GetAllUsers{err: fmt.Errorf("expected exactly 1 result from query 'GetAllUsers' found %s", amount)}
	}
	return first
}
func (this *Iter_UServ_GetAllUsers) Zero() error {
	row, ok := this.Next()
	if row != nil && row.err != nil {
		return row.err
	}
	if ok {
		return fmt.Errorf("expected exactly 0 results from query 'GetAllUsers'")
	}
	return nil
}
func (this *Iter_UServ_GetAllUsers) Next() (*Row_UServ_GetAllUsers, bool) {
	row, err := this.rows.Next()
	_ = row
	if err == iterator.Done {
		return nil, false
	}
	if err != nil {
		return &Row_UServ_GetAllUsers{err: err}, true
	}
	var id int64
	if err := row.ColumnByName("id", &id); err != nil {
		return &Row_UServ_GetAllUsers{err: fmt.Errorf("cant convert db column id to protobuf go type int64")}, true
	}
	var name string
	if err := row.ColumnByName("name", &name); err != nil {
		return &Row_UServ_GetAllUsers{err: fmt.Errorf("cant convert db column name to protobuf go type string")}, true
	}
	friends := &Friends{}
	friendsBytes := make([]byte, 0)
	if err := row.ColumnByName("friends", &friendsBytes); err != nil {
		return &Row_UServ_GetAllUsers{err: fmt.Errorf("failed to convert db column friends to []byte")}, true
	}
	if err := proto.Unmarshal(friendsBytes, friends); err != nil {
		return &Row_UServ_GetAllUsers{err: fmt.Errorf("failed to unmarshal column friends to proto message")}, true
	}
	var created_on *timestamp.Timestamp
	var created_on_col spanner.GenericColumnValue
	if err := row.ColumnByName("created_on", &created_on_col); err != nil {
		return &Row_UServ_GetAllUsers{err: fmt.Errorf("failed to convert db column created_on to spanner.GenericColumnValue")}, true
	}
	convert_created_on := this.tm.TimestampTimestamp()
	if err := convert_created_on.SpannerScan(&created_on_col); err != nil {
		return &Row_UServ_GetAllUsers{err: fmt.Errorf("SpannerScan failed for created_on")}, true
	}
	if err := convert_created_on.ToProto(&created_on); err != nil {
		return &Row_UServ_GetAllUsers{err: fmt.Errorf("ToProto for created_on when reading from spanner")}, true
	}
	res := &User{
		Id:        id,
		Name:      name,
		Friends:   friends,
		CreatedOn: created_on,
	}
	return &Row_UServ_GetAllUsers{item: res}, true
}
func (this *Iter_UServ_GetAllUsers) Slice() []*Row_UServ_GetAllUsers {
	var results []*Row_UServ_GetAllUsers
	for {
		if i, ok := this.Next(); ok {
			results = append(results, i)
		} else {
			break
		}
	}
	return results
}
type Iter_UServ_SelectUserById struct {
	result *SpannerResult
	rows   *spanner.RowIterator
	err    error
	tm     TypeMappings_UServ
	ctx    context.Context
}
func (this *Iter_UServ_SelectUserById) IterOutTypeUser() {}
func (this *Iter_UServ_SelectUserById) IterInTypeUser()  {}