Cloud Spanner Client - Class CommitTimestamp (1.54.2)
Stay organized with collections
Save and categorize content based on your preferences.
Reference documentation and code samples for the Cloud Spanner Client class CommitTimestamp.
A special value which, when used, will set the field value to the value of
the commit timestamp.
Cloud Spanner allows users to designate a specific Timestamp column in the
table schema to contain commit timestamps. When writing to this column, a
manually-created timestamp (in the past) may be supplied, or Cloud Spanner
can populate it server-side.
Note that this special value cannot be used unless the column has been
annotated with support for commit timestamps:
CREATE TABLE myTable (
id STRING(100) NOT NULL,
commitTimestamp TIMESTAMP NOT NULL OPTIONS
(allow_commit_timestamp=true)
) PRIMARY KEY(id, commitTimestamp DESC)
Example:
use Google\Cloud\Spanner\SpannerClient;
$spanner = new SpannerClient();
$database = $spanner->connect('my-instance', 'my-database');
$database->insert('myTable', [
'id' => $id,
'commitTimestamp' => $spanner->commitTimestamp()
]);
[[["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 2026-07-31 UTC."],[],[]]