typector

package
v0.3.11 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2026 License: MIT Imports: 2 Imported by: 2

Documentation

Overview

Package typector provides small constructor helpers for building Cloud Spanner google.spanner.v1.Type values and struct fields in tests and callers. PostgreSQL-oriented types use sppb.Type.TypeAnnotation; see SimpleTypeWithAnnotation, PGNumeric, PGJSONB, and PGOID.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool added in v0.3.9

func Bool() *sppb.Type

Bool returns a BOOL type.

func Bytes added in v0.3.9

func Bytes() *sppb.Type

Bytes returns a BYTES type.

func CodeToSimpleType

func CodeToSimpleType(code sppb.TypeCode) *sppb.Type

CodeToSimpleType returns a simple non-container type for the given code.

func CodeToUnnamedStructTypeField added in v0.3.6

func CodeToUnnamedStructTypeField(code sppb.TypeCode) *sppb.StructType_Field

CodeToUnnamedStructTypeField returns an unnamed STRUCT field for the given type code.

func Date added in v0.3.9

func Date() *sppb.Type

Date returns a DATE type.

func ElemCodeToArrayType

func ElemCodeToArrayType(code sppb.TypeCode) *sppb.Type

ElemCodeToArrayType returns an ARRAY type with the given element type code.

func ElemTypeToArrayType

func ElemTypeToArrayType(typ *sppb.Type) *sppb.Type

ElemTypeToArrayType returns an ARRAY type with the given element type.

func FQNToEnumType

func FQNToEnumType(fqn string) *sppb.Type

FQNToEnumType returns an ENUM type for the given fully-qualified name.

func FQNToProtoType

func FQNToProtoType(fqn string) *sppb.Type

FQNToProtoType returns a PROTO type for the given fully-qualified name.

func Float32 added in v0.3.9

func Float32() *sppb.Type

Float32 returns a FLOAT32 type.

func Float64 added in v0.3.9

func Float64() *sppb.Type

Float64 returns a FLOAT64 type.

func Int64 added in v0.3.9

func Int64() *sppb.Type

Int64 returns an INT64 type.

func Interval added in v0.3.9

func Interval() *sppb.Type

Interval returns an INTERVAL type.

func JSON added in v0.3.9

func JSON() *sppb.Type

JSON returns a JSON type.

func MustNameCodeSlicesToStructType added in v0.3.5

func MustNameCodeSlicesToStructType(names []string, codes []sppb.TypeCode) *sppb.Type

MustNameCodeSlicesToStructType is like NameCodeSlicesToStructType but panics on error.

func MustNameCodeSlicesToStructTypeFields added in v0.3.5

func MustNameCodeSlicesToStructTypeFields(names []string, codes []sppb.TypeCode) []*sppb.StructType_Field

MustNameCodeSlicesToStructTypeFields is like NameCodeSlicesToStructTypeFields but panics on error.

func MustNameTypeSlicesToStructType added in v0.3.5

func MustNameTypeSlicesToStructType(names []string, types []*sppb.Type) *sppb.Type

MustNameTypeSlicesToStructType is like NameTypeSlicesToStructType but panics on error.

func MustNameTypeSlicesToStructTypeFields added in v0.3.5

func MustNameTypeSlicesToStructTypeFields(names []string, types []*sppb.Type) []*sppb.StructType_Field

MustNameTypeSlicesToStructTypeFields is like NameTypeSlicesToStructTypeFields but panics on error.

func NameCodeSlicesToStructType added in v0.3.5

func NameCodeSlicesToStructType(names []string, codes []sppb.TypeCode) (*sppb.Type, error)

NameCodeSlicesToStructType returns a STRUCT type from parallel slices of field names and type codes.

func NameCodeSlicesToStructTypeFields added in v0.3.5

func NameCodeSlicesToStructTypeFields(names []string, codes []sppb.TypeCode) ([]*sppb.StructType_Field, error)

NameCodeSlicesToStructTypeFields returns STRUCT fields from parallel slices of field names and type codes.

func NameCodeToStructType

func NameCodeToStructType(name string, code sppb.TypeCode) *sppb.Type

NameCodeToStructType returns a single-field STRUCT type from a field name and type code.

func NameCodeToStructTypeField

func NameCodeToStructTypeField(name string, code sppb.TypeCode) *sppb.StructType_Field

NameCodeToStructTypeField returns a STRUCT field from a field name and type code.

func NameTypeSlicesToStructType added in v0.3.5

func NameTypeSlicesToStructType(names []string, types []*sppb.Type) (*sppb.Type, error)

NameTypeSlicesToStructType returns a STRUCT type from parallel slices of field names and types.

func NameTypeSlicesToStructTypeFields added in v0.3.5

func NameTypeSlicesToStructTypeFields(names []string, types []*sppb.Type) ([]*sppb.StructType_Field, error)

NameTypeSlicesToStructTypeFields returns STRUCT fields from parallel slices of field names and types.

func NameTypeToStructType

func NameTypeToStructType(name string, typ *sppb.Type) *sppb.Type

NameTypeToStructType returns a single-field STRUCT type from a field name and type.

func NameTypeToStructTypeField

func NameTypeToStructTypeField(name string, typ *sppb.Type) *sppb.StructType_Field

NameTypeToStructTypeField returns a STRUCT field from a field name and type.

func Numeric added in v0.3.9

func Numeric() *sppb.Type

Numeric returns a NUMERIC type.

func PGJSONB added in v0.3.11

func PGJSONB() *sppb.Type

PGJSONB returns a JSON type with PostgreSQL sppb.TypeAnnotationCode_PG_JSONB semantics.

func PGNumeric added in v0.3.11

func PGNumeric() *sppb.Type

PGNumeric returns a NUMERIC type with PostgreSQL sppb.TypeAnnotationCode_PG_NUMERIC semantics.

func PGOID added in v0.3.11

func PGOID() *sppb.Type

PGOID returns an INT64 type with PostgreSQL sppb.TypeAnnotationCode_PG_OID semantics.

func SimpleTypeWithAnnotation added in v0.3.11

func SimpleTypeWithAnnotation(code sppb.TypeCode, ann sppb.TypeAnnotationCode) *sppb.Type

SimpleTypeWithAnnotation returns a simple type with the given code and optional sppb.Type.TypeAnnotation (use sppb.TypeAnnotationCode_TYPE_ANNOTATION_CODE_UNSPECIFIED for none).

func String added in v0.3.9

func String() *sppb.Type

String returns a STRING type.

func StructTypeFieldsToStructType

func StructTypeFieldsToStructType(fields []*sppb.StructType_Field) *sppb.Type

StructTypeFieldsToStructType returns a STRUCT type with the given fields.

func Timestamp added in v0.3.9

func Timestamp() *sppb.Type

Timestamp returns a TIMESTAMP type.

func TypeToUnnamedStructTypeField added in v0.3.6

func TypeToUnnamedStructTypeField(typ *sppb.Type) *sppb.StructType_Field

TypeToUnnamedStructTypeField returns an unnamed STRUCT field for the given type.

func UUID added in v0.3.9

func UUID() *sppb.Type

UUID returns a UUID type.

Types

This section is empty.

Jump to

Keyboard shortcuts

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