Reference documentation and code samples for the Cloud Spanner V1 Client class TypeCode.
TypeCodeis used as part ofTypeto
indicate the type of a Cloud Spanner value.
Each legal value of a type can be encoded to or decoded from a JSON
value, using the encodings described below. All Cloud Spanner values can
benull, regardless of type;nulls are always encoded as a JSONnull.
Protobuf typegoogle.spanner.v1.TypeCode
Namespace
Google \ Cloud \ Spanner \ V1
Methods
static::name
Parameter
Name
Description
value
mixed
static::value
Parameter
Name
Description
name
mixed
Constants
TYPE_CODE_UNSPECIFIED
Value: 0
Not specified.
Generated from protobuf enumTYPE_CODE_UNSPECIFIED = 0;
BOOL
Value: 1
Encoded as JSONtrueorfalse.
Generated from protobuf enumBOOL = 1;
INT64
Value: 2
Encoded asstring, in decimal format.
Generated from protobuf enumINT64 = 2;
FLOAT64
Value: 3
Encoded asnumber, or the strings"NaN","Infinity", or"-Infinity".
Generated from protobuf enumFLOAT64 = 3;
FLOAT32
Value: 15
Encoded asnumber, or the strings"NaN","Infinity", or"-Infinity".
Generated from protobuf enumFLOAT32 = 15;
TIMESTAMP
Value: 4
Encoded asstringin RFC 3339 timestamp format. The time zone
must be present, and must be"Z".
If the schema has the column optionallow_commit_timestamp=true, the placeholder string"spanner.commit_timestamp()"can be used to instruct the system
to insert the commit timestamp associated with the transaction
commit.
Generated from protobuf enumTIMESTAMP = 4;
DATE
Value: 5
Encoded asstringin RFC 3339 date format.
Generated from protobuf enumDATE = 5;
STRING
Value: 6
Encoded asstring.
Generated from protobuf enumSTRING = 6;
BYTES
Value: 7
Encoded as a base64-encodedstring, as described in RFC 4648,
section 4.
Generated from protobuf enumBYTES = 7;
PBARRAY
Value: 8
Encoded aslist, where the list elements are represented
according toarray_element_type.
Generated from protobuf enumARRAY = 8;
STRUCT
Value: 9
Encoded aslist, where list elementiis represented according
to [struct_type.fields[i]][google.spanner.v1.StructType.fields].
Generated from protobuf enumSTRUCT = 9;
NUMERIC
Value: 10
Encoded asstring, in decimal format or scientific notation format.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Cloud Spanner V1 Client - Class TypeCode (1.104.0)\n\nVersion latestkeyboard_arrow_down\n\n- [1.104.0 (latest)](/php/docs/reference/cloud-spanner/latest/V1.TypeCode)\n- [1.103.0](/php/docs/reference/cloud-spanner/1.103.0/V1.TypeCode)\n- [1.102.0](/php/docs/reference/cloud-spanner/1.102.0/V1.TypeCode)\n- [1.101.0](/php/docs/reference/cloud-spanner/1.101.0/V1.TypeCode)\n- [1.100.0](/php/docs/reference/cloud-spanner/1.100.0/V1.TypeCode)\n- [1.98.0](/php/docs/reference/cloud-spanner/1.98.0/V1.TypeCode)\n- [1.97.0](/php/docs/reference/cloud-spanner/1.97.0/V1.TypeCode)\n- [1.96.0](/php/docs/reference/cloud-spanner/1.96.0/V1.TypeCode)\n- [1.95.0](/php/docs/reference/cloud-spanner/1.95.0/V1.TypeCode)\n- [1.94.0](/php/docs/reference/cloud-spanner/1.94.0/V1.TypeCode)\n- [1.93.1](/php/docs/reference/cloud-spanner/1.93.1/V1.TypeCode)\n- [1.92.1](/php/docs/reference/cloud-spanner/1.92.1/V1.TypeCode)\n- [1.91.0](/php/docs/reference/cloud-spanner/1.91.0/V1.TypeCode)\n- [1.90.0](/php/docs/reference/cloud-spanner/1.90.0/V1.TypeCode)\n- [1.89.0](/php/docs/reference/cloud-spanner/1.89.0/V1.TypeCode)\n- [1.88.0](/php/docs/reference/cloud-spanner/1.88.0/V1.TypeCode)\n- [1.87.0](/php/docs/reference/cloud-spanner/1.87.0/V1.TypeCode)\n- [1.86.0](/php/docs/reference/cloud-spanner/1.86.0/V1.TypeCode)\n- [1.85.0](/php/docs/reference/cloud-spanner/1.85.0/V1.TypeCode)\n- [1.84.0](/php/docs/reference/cloud-spanner/1.84.0/V1.TypeCode)\n- [1.83.0](/php/docs/reference/cloud-spanner/1.83.0/V1.TypeCode)\n- [1.82.0](/php/docs/reference/cloud-spanner/1.82.0/V1.TypeCode)\n- [1.81.0](/php/docs/reference/cloud-spanner/1.81.0/V1.TypeCode)\n- [1.80.0](/php/docs/reference/cloud-spanner/1.80.0/V1.TypeCode)\n- [1.79.0](/php/docs/reference/cloud-spanner/1.79.0/V1.TypeCode)\n- [1.78.0](/php/docs/reference/cloud-spanner/1.78.0/V1.TypeCode)\n- [1.77.0](/php/docs/reference/cloud-spanner/1.77.0/V1.TypeCode)\n- [1.76.1](/php/docs/reference/cloud-spanner/1.76.1/V1.TypeCode)\n- [1.68.0](/php/docs/reference/cloud-spanner/1.68.0/V1.TypeCode)\n- [1.67.0](/php/docs/reference/cloud-spanner/1.67.0/V1.TypeCode)\n- [1.66.0](/php/docs/reference/cloud-spanner/1.66.0/V1.TypeCode)\n- [1.65.0](/php/docs/reference/cloud-spanner/1.65.0/V1.TypeCode)\n- [1.64.0](/php/docs/reference/cloud-spanner/1.64.0/V1.TypeCode)\n- [1.63.2](/php/docs/reference/cloud-spanner/1.63.2/V1.TypeCode)\n- [1.62.1](/php/docs/reference/cloud-spanner/1.62.1/V1.TypeCode)\n- [1.61.0](/php/docs/reference/cloud-spanner/1.61.0/V1.TypeCode)\n- [1.60.0](/php/docs/reference/cloud-spanner/1.60.0/V1.TypeCode)\n- [1.59.0](/php/docs/reference/cloud-spanner/1.59.0/V1.TypeCode)\n- [1.58.4](/php/docs/reference/cloud-spanner/1.58.4/V1.TypeCode)\n- [1.57.0](/php/docs/reference/cloud-spanner/1.57.0/V1.TypeCode)\n- [1.56.0](/php/docs/reference/cloud-spanner/1.56.0/V1.TypeCode)\n- [1.55.0](/php/docs/reference/cloud-spanner/1.55.0/V1.TypeCode)\n- [1.54.2](/php/docs/reference/cloud-spanner/1.54.2/V1.TypeCode) \nReference documentation and code samples for the Cloud Spanner V1 Client class TypeCode.\n\n`TypeCode` is used as part of [Type](/php/docs/reference/cloud-spanner/latest/V1.Type) to\nindicate the type of a Cloud Spanner value.\n\nEach legal value of a type can be encoded to or decoded from a JSON\nvalue, using the encodings described below. All Cloud Spanner values can\nbe `null`, regardless of type; `null`s are always encoded as a JSON\n`null`.\n\nProtobuf type `google.spanner.v1.TypeCode`\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ Spanner \\\\ V1\n\nMethods\n-------\n\n### static::name\n\n### static::value\n\nConstants\n---------\n\n### TYPE_CODE_UNSPECIFIED\n\n Value: 0\n\nNot specified.\n\nGenerated from protobuf enum `TYPE_CODE_UNSPECIFIED = 0;`\n\n### BOOL\n\n Value: 1\n\nEncoded as JSON `true` or `false`.\n\nGenerated from protobuf enum `BOOL = 1;`\n\n### INT64\n\n Value: 2\n\nEncoded as `string`, in decimal format.\n\nGenerated from protobuf enum `INT64 = 2;`\n\n### FLOAT64\n\n Value: 3\n\nEncoded as `number`, or the strings `\"NaN\"`, `\"Infinity\"`, or\n`\"-Infinity\"`.\n\nGenerated from protobuf enum `FLOAT64 = 3;`\n\n### FLOAT32\n\n Value: 15\n\nEncoded as `number`, or the strings `\"NaN\"`, `\"Infinity\"`, or\n`\"-Infinity\"`.\n\nGenerated from protobuf enum `FLOAT32 = 15;`\n\n### TIMESTAMP\n\n Value: 4\n\nEncoded as `string` in RFC 3339 timestamp format. The time zone\nmust be present, and must be `\"Z\"`.\n\nIf the schema has the column option\n`allow_commit_timestamp=true`, the placeholder string\n`\"spanner.commit_timestamp()\"` can be used to instruct the system\nto insert the commit timestamp associated with the transaction\ncommit.\n\nGenerated from protobuf enum `TIMESTAMP = 4;`\n\n### DATE\n\n Value: 5\n\nEncoded as `string` in RFC 3339 date format.\n\nGenerated from protobuf enum `DATE = 5;`\n\n### STRING\n\n Value: 6\n\nEncoded as `string`.\n\nGenerated from protobuf enum `STRING = 6;`\n\n### BYTES\n\n Value: 7\n\nEncoded as a base64-encoded `string`, as described in RFC 4648,\nsection 4.\n\nGenerated from protobuf enum `BYTES = 7;`\n\n### PBARRAY\n\n Value: 8\n\nEncoded as `list`, where the list elements are represented\naccording to\n[array_element_type](/php/docs/reference/cloud-spanner/latest/V1.Type#_Google_Cloud_Spanner_V1_Type__getArrayElementType__).\n\nGenerated from protobuf enum `ARRAY = 8;`\n\n### STRUCT\n\n Value: 9\n\nEncoded as `list`, where list element `i` is represented according\nto \\[struct_type.fields\\[i\\]\\]\\[google.spanner.v1.StructType.fields\\].\n\nGenerated from protobuf enum `STRUCT = 9;`\n\n### NUMERIC\n\n Value: 10\n\nEncoded as `string`, in decimal format or scientific notation format.\n\nDecimal format:\n`[+-]Digits[.[Digits]]` or\n`\u003cxref uid=\"\\\\Digits\"\u003e+-\u003c/xref\u003e.Digits`\nScientific notation:\n`[+-]Digits[.[Digits]][ExponentIndicator[+-]Digits]` or\n`\u003cxref uid=\"\\\\Digits\"\u003e+-\u003c/xref\u003e.Digits[ExponentIndicator[+-]Digits]`\n(ExponentIndicator is `\"e\"` or `\"E\"`)\n\nGenerated from protobuf enum `NUMERIC = 10;`\n\n### JSON\n\n Value: 11\n\nEncoded as a JSON-formatted `string` as described in RFC 7159. The\nfollowing rules are applied when parsing JSON input:\n\n- Whitespace characters are not preserved.\n\n- If a JSON object has duplicate keys, only the first key is preserved.\n\n- Members of a JSON object are not guaranteed to have their order preserved.\n- JSON array elements will have their order preserved.\n\nGenerated from protobuf enum `JSON = 11;`\n\n### PROTO\n\n Value: 13\n\nEncoded as a base64-encoded `string`, as described in RFC 4648,\nsection 4.\n\nGenerated from protobuf enum `PROTO = 13;`\n\n### ENUM\n\n Value: 14\n\nEncoded as `string`, in decimal format.\n\nGenerated from protobuf enum `ENUM = 14;`\n\n### INTERVAL\n\n Value: 16\n\nEncoded as `string`, in `ISO8601` duration format -\n`P[n]Y[n]M[n]DT[n]H[n]M[n[.fraction]]S`\nwhere `n` is an integer.\n\nFor example, `P1Y2M3DT4H5M6.5S` represents time duration of 1 year, 2\nmonths, 3 days, 4 hours, 5 minutes, and 6.5 seconds.\n\nGenerated from protobuf enum `INTERVAL = 16;`\n\n### UUID\n\n Value: 17\n\nEncoded as `string`, in lower-case hexa-decimal format, as described\nin RFC 9562, section 4.\n\nGenerated from protobuf enum `UUID = 17;`"]]