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 ¶
- func Bool() *sppb.Type
- func Bytes() *sppb.Type
- func CodeToSimpleType(code sppb.TypeCode) *sppb.Type
- func CodeToUnnamedStructTypeField(code sppb.TypeCode) *sppb.StructType_Field
- func Date() *sppb.Type
- func ElemCodeToArrayType(code sppb.TypeCode) *sppb.Type
- func ElemTypeToArrayType(typ *sppb.Type) *sppb.Type
- func FQNToEnumType(fqn string) *sppb.Type
- func FQNToProtoType(fqn string) *sppb.Type
- func Float32() *sppb.Type
- func Float64() *sppb.Type
- func Int64() *sppb.Type
- func Interval() *sppb.Type
- func JSON() *sppb.Type
- func MustNameCodeSlicesToStructType(names []string, codes []sppb.TypeCode) *sppb.Type
- func MustNameCodeSlicesToStructTypeFields(names []string, codes []sppb.TypeCode) []*sppb.StructType_Field
- func MustNameTypeSlicesToStructType(names []string, types []*sppb.Type) *sppb.Type
- func MustNameTypeSlicesToStructTypeFields(names []string, types []*sppb.Type) []*sppb.StructType_Field
- func NameCodeSlicesToStructType(names []string, codes []sppb.TypeCode) (*sppb.Type, error)
- func NameCodeSlicesToStructTypeFields(names []string, codes []sppb.TypeCode) ([]*sppb.StructType_Field, error)
- func NameCodeToStructType(name string, code sppb.TypeCode) *sppb.Type
- func NameCodeToStructTypeField(name string, code sppb.TypeCode) *sppb.StructType_Field
- func NameTypeSlicesToStructType(names []string, types []*sppb.Type) (*sppb.Type, error)
- func NameTypeSlicesToStructTypeFields(names []string, types []*sppb.Type) ([]*sppb.StructType_Field, error)
- func NameTypeToStructType(name string, typ *sppb.Type) *sppb.Type
- func NameTypeToStructTypeField(name string, typ *sppb.Type) *sppb.StructType_Field
- func Numeric() *sppb.Type
- func PGJSONB() *sppb.Type
- func PGNumeric() *sppb.Type
- func PGOID() *sppb.Type
- func SimpleTypeWithAnnotation(code sppb.TypeCode, ann sppb.TypeAnnotationCode) *sppb.Type
- func String() *sppb.Type
- func StructTypeFieldsToStructType(fields []*sppb.StructType_Field) *sppb.Type
- func Timestamp() *sppb.Type
- func TypeToUnnamedStructTypeField(typ *sppb.Type) *sppb.StructType_Field
- func UUID() *sppb.Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CodeToSimpleType ¶
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 ElemCodeToArrayType ¶
ElemCodeToArrayType returns an ARRAY type with the given element type code.
func ElemTypeToArrayType ¶
ElemTypeToArrayType returns an ARRAY type with the given element type.
func FQNToEnumType ¶
FQNToEnumType returns an ENUM type for the given fully-qualified name.
func FQNToProtoType ¶
FQNToProtoType returns a PROTO type for the given fully-qualified name.
func MustNameCodeSlicesToStructType ¶ added in v0.3.5
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
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
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 ¶
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
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 ¶
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 PGJSONB ¶ added in v0.3.11
PGJSONB returns a JSON type with PostgreSQL sppb.TypeAnnotationCode_PG_JSONB semantics.
func PGNumeric ¶ added in v0.3.11
PGNumeric returns a NUMERIC type with PostgreSQL sppb.TypeAnnotationCode_PG_NUMERIC semantics.
func PGOID ¶ added in v0.3.11
PGOID returns an INT64 type with PostgreSQL sppb.TypeAnnotationCode_PG_OID semantics.
func SimpleTypeWithAnnotation ¶ added in v0.3.11
SimpleTypeWithAnnotation returns a simple type with the given code and optional sppb.Type.TypeAnnotation (use sppb.TypeAnnotationCode_TYPE_ANNOTATION_CODE_UNSPECIFIED for none).
func StructTypeFieldsToStructType ¶
func StructTypeFieldsToStructType(fields []*sppb.StructType_Field) *sppb.Type
StructTypeFieldsToStructType returns a STRUCT type with the given fields.
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.
Types ¶
This section is empty.