spannerutil

package
v1.107.2 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2024 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Error = errs.Class("spannerutil")

Error is error class for this package.

Functions

func CollectRow added in v1.106.1

func CollectRow[T any](iter *spanner.RowIterator, scan func(row *spanner.Row, item *T) error) (r T, _ error)

CollectRow scans a single row into a slice.

func CollectRows added in v1.106.1

func CollectRows[T any](iter *spanner.RowIterator, scan func(row *spanner.Row, item *T) error) (rs []T, _ error)

CollectRows scans each row into a slice.

Types

type IntValueDecoder

type IntValueDecoder[T inty] struct {
	// contains filtered or unexported fields
}

IntValueDecoder is a type wrapping an int pointer so it can decode integer values from Spanner directly (Spanner prefers to work only in int64s).

func Int

func Int[T inty](val *T) IntValueDecoder[T]

Int wraps a pointer to an int-based type in a type that can be decoded directly from Spanner.

In general, it is preferable to add EncodeSpanner/DecodeSpanner methods to our specialized int types, but this can be used for types we don't own or otherwise can't put methods on.

func (IntValueDecoder[T]) DecodeSpanner

func (s IntValueDecoder[T]) DecodeSpanner(input any) error

DecodeSpanner decodes a value from a Spanner-stored type to the appropriate int type. It implements spanner.Decoder.

Jump to

Keyboard shortcuts

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