utility

package
v1.61.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildQuery

func BuildQuery(queryAction *executorpb.QueryAction) (spanner.Statement, error)

BuildQuery constructs a spanner.Statement query and bind the params from the input executorpb.QueryAction.

func ConvertSpannerRow

func ConvertSpannerRow(row *spanner.Row) (*executorpb.ValueList, *sppb.StructType, error)

ConvertSpannerRow takes a Cloud Spanner Row and translates it to executorpb.ValueList and sppb.StructType. The result is always a struct, in which each value corresponds to a column of the Row.

func ErrToStatus

func ErrToStatus(e error) *spb.Status

ErrToStatus maps cloud error to Status

func ExecutorValueToSpannerValue

func ExecutorValueToSpannerValue(t *spannerpb.Type, v *executorpb.Value, null bool) (any, error)

ExecutorValueToSpannerValue converts executorpb.Value with given spannerpb.Type into a cloud spanner interface. Parameter null indicates whether this value is NULL.

func KeySetProtoToCloudKeySet

func KeySetProtoToCloudKeySet(keySetProto *executorpb.KeySet, typeList []*spannerpb.Type) (spanner.KeySet, error)

KeySetProtoToCloudKeySet converts executorpb.KeySet to spanner.KeySet.

Types

type TableMetadataHelper

type TableMetadataHelper struct {
	// contains filtered or unexported fields
}

TableMetadataHelper is used to hold and retrieve metadata of tables and columns involved in a transaction.

func (*TableMetadataHelper) GetColumnType

func (t *TableMetadataHelper) GetColumnType(tableName string, colName string) (*spannerpb.Type, error)

GetColumnType returns the column type of the given table and column.

func (*TableMetadataHelper) GetKeyColumnTypes

func (t *TableMetadataHelper) GetKeyColumnTypes(tableName string) ([]*spannerpb.Type, error)

GetKeyColumnTypes returns a list of key column types of the given table.

func (*TableMetadataHelper) InitFrom

InitFrom reads table metadata from the given StartTransactionAction.

func (*TableMetadataHelper) InitFromTableMetadata

func (t *TableMetadataHelper) InitFromTableMetadata(tables []*executorpb.TableMetadata)

InitFromTableMetadata extracts table metadata and make maps to store them.

Jump to

Keyboard shortcuts

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