spanner

package
v0.0.23 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 12, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NewSession = func(ctx context.Context, opt config.Spanner) (ISession, error) {
	options := make([]option.ClientOption, 0)
	if opt.EndPoint != "" {
		options = append(options, option.WithEndpoint(opt.EndPoint))
	}
	if opt.WithoutAuthentication {
		options = append(options, option.WithoutAuthentication())
	}
	if opt.GRPCInsecure {
		options = append(options, option.WithGRPCDialOption(grpc.WithTransportCredentials(insecure.NewCredentials())))
	}
	return newClient(ctx, fmt.Sprintf(`projects/%s/instances/%s/databases/%s`, opt.ProjectID, opt.Instance, opt.Database), options...)
}

NewSession method

Functions

This section is empty.

Types

type ISession

type ISession interface {
	Close()
	Single() *spanner.ReadOnlyTransaction
	ReadOnlyTransaction() *spanner.ReadOnlyTransaction
	BatchReadOnlyTransaction(ctx context.Context, tb spanner.TimestampBound) (*spanner.BatchReadOnlyTransaction, error)
	BatchReadOnlyTransactionFromID(tid spanner.BatchReadOnlyTransactionID) *spanner.BatchReadOnlyTransaction
	ReadWriteTransaction(ctx context.Context, f func(context.Context, *spanner.ReadWriteTransaction) error) (commitTimestamp time.Time, err error)
	Apply(ctx context.Context, ms []*spanner.Mutation, opts ...spanner.ApplyOption) (commitTimestamp time.Time, err error)
	PartitionedUpdate(ctx context.Context, statement spanner.Statement) (count int64, err error)
	PartitionedUpdateWithOptions(ctx context.Context, statement spanner.Statement, opts spanner.QueryOptions) (count int64, err error)
}

ISession interface

func NewExtendSpannerDatabase

func NewExtendSpannerDatabase(logger *zap.Logger, opt config.Spanner) (ISession, func(), error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL