func durationProto(d time.Duration) *pbd.Duration {
	n := d.Nanoseconds()
	return &pbd.Duration{
		Seconds: n / int64(time.Second),
		Nanos:   int32(n % int64(time.Second)),
	}
}
durationProto takes a time.Duration and converts it into pdb.Duration for
calling gRPC APIs.
package spanner
import (
	"fmt"
	"time"
	pbd "github.com/golang/protobuf/ptypes/duration"
	pbt "github.com/golang/protobuf/ptypes/timestamp"
	sppb "google.golang.org/genproto/googleapis/spanner/v1"
)
type timestampBoundType int
const (
	strong           timestampBoundType = iota  
	exactStaleness                              
	maxStaleness                                
	minReadTimestamp                            
	readTimestamp                               
)
type TimestampBound struct {
	mode timestampBoundType
	d    time.Duration
	t    time.Time
}
func StrongRead() TimestampBound {
	return TimestampBound{mode: strong}
}
func ExactStaleness(d time.Duration) TimestampBound {
	return TimestampBound{
		mode: exactStaleness,
		d:    d,
	}
}
func MaxStaleness(d time.Duration) TimestampBound {
	return TimestampBound{
		mode: maxStaleness,
		d:    d,
	}
}
func MinReadTimestamp(t time.Time) TimestampBound {
	return TimestampBound{
		mode: minReadTimestamp,
		t:    t,
	}
}
func ReadTimestamp(t time.Time) TimestampBound {
	return TimestampBound{
		mode: readTimestamp,
		t:    t,
	}
}
func (tb TimestampBound) String() string {
	switch tb.mode {
	case strong:
		return fmt.Sprintf("(strong)")
	case exactStaleness:
		return fmt.Sprintf("(exactStaleness: %s)", tb.d)
	case maxStaleness:
		return fmt.Sprintf("(maxStaleness: %s)", tb.d)
	case minReadTimestamp:
		return fmt.Sprintf("(minReadTimestamp: %s)", tb.t)
	case readTimestamp:
		return fmt.Sprintf("(readTimestamp: %s)", tb.t)
	default:
		return fmt.Sprintf("{mode=%v, d=%v, t=%v}", tb.mode, tb.d, tb.t)
	}
}