|
1 | | -<img src="https://avatars2.githubusercontent.com/u/2810941?v=3&s=96" alt="Google Cloud Platform logo" title="Google Cloud Platform" align="right" height="96" width="96"/> |
2 | | - |
3 | | -# Cloud Spanner: Node.js Samples |
4 | | - |
5 | | -[]() |
6 | | - |
7 | | -[Cloud Spanner](https://cloud.google.com/spanner/docs/) is a fully managed, mission-critical, relational database service that offers transactional consistency at global scale, schemas, SQL (ANSI 2011 with extensions), and automatic, synchronous replication for high availability. |
8 | | - |
9 | | -## Table of Contents |
10 | | - |
11 | | -* [Setup](#setup) |
12 | | -* [Samples](#samples) |
13 | | - * [Schema](#schema) |
14 | | - * [CRUD](#crud) |
15 | | - * [Indexing](#indexing) |
16 | | - * [Transactions](#transactions) |
17 | | -* [Running the tests](#running-the-tests) |
18 | | - |
19 | | -## Setup |
20 | | - |
21 | | - |
22 | | -## Samples |
23 | | - |
24 | | -### Schema |
25 | | - |
26 | | -View the [documentation][schema_0_docs] or the [source code][schema_0_code]. |
27 | | - |
28 | | -__Usage:__ `node schema.js --help` |
29 | | - |
30 | | -``` |
31 | | -Commands: |
32 | | - createDatabase <instanceName> <databaseName> Creates an example database with two tables in a Cloud Spanner instance. |
33 | | - addColumn <instanceName> <databaseName> Adds an example MarketingBudget column to an example Cloud Spanner |
34 | | - table. |
35 | | - queryNewColumn <instanceName> <databaseName> Executes a read-only SQL query against an example Cloud Spanner table |
36 | | - with an additional column (MarketingBudget) added by addColumn. |
37 | | -
|
38 | | -Options: |
39 | | - --help Show help [boolean] |
40 | | -
|
41 | | -Examples: |
42 | | - node schema.js createDatabase "my-instance" "my-database" |
43 | | - node schema.js addColumn "my-instance" "my-database" |
44 | | - node schema.js queryNewColumn "my-instance" "my-database" |
45 | | -
|
46 | | -For more information, see https://cloud.google.com/spanner/docs |
47 | | -``` |
48 | | - |
49 | | -[schema_0_docs]: https://cloud.google.com/spanner/docs |
50 | | -[schema_0_code]: schema.js |
51 | | - |
52 | | -### CRUD |
53 | | - |
54 | | -View the [documentation][crud_1_docs] or the [source code][crud_1_code]. |
55 | | - |
56 | | -__Usage:__ `node crud.js --help` |
57 | | - |
58 | | -``` |
59 | | -Commands: |
60 | | - update <instanceName> <databaseName> Modifies existing rows of data in an example Cloud Spanner table. |
61 | | - query <instanceName> <databaseName> Executes a read-only SQL query against an example Cloud Spanner table. |
62 | | - insert <instanceName> <databaseName> Inserts new rows of data into an example Cloud Spanner table. |
63 | | - read <instanceName> <databaseName> Reads data in an example Cloud Spanner table. |
64 | | - read-stale <instanceName> <databaseName> Reads data in an example Cloud Spanner table. |
65 | | -
|
66 | | -Options: |
67 | | - --help Show help [boolean] |
68 | | -
|
69 | | -Examples: |
70 | | - node crud.js update "my-instance" "my-database" |
71 | | - node crud.js query "my-instance" "my-database" |
72 | | - node crud.js insert "my-instance" "my-database" |
73 | | - node crud.js read "my-instance" "my-database" |
74 | | -
|
75 | | -For more information, see https://cloud.google.com/spanner/docs |
76 | | -``` |
77 | | - |
78 | | -[crud_1_docs]: https://cloud.google.com/spanner/docs |
79 | | -[crud_1_code]: crud.js |
80 | | - |
81 | | -### Indexing |
82 | | - |
83 | | -View the [documentation][indexing_2_docs] or the [source code][indexing_2_code]. |
84 | | - |
85 | | -__Usage:__ `node indexing.js --help` |
86 | | - |
87 | | -``` |
88 | | -Commands: |
89 | | - createIndex <instanceName> <databaseName> Creates a new index in an example Cloud Spanner table. |
90 | | - createStoringIndex <instanceName> <databaseName> Creates a new value-storing index in an example Cloud Spanner table. |
91 | | - queryIndex <instanceName> <databaseName> Executes a read-only SQL query against an example Cloud Spanner |
92 | | - table using an existing index. |
93 | | - Returns results with titles between a start title (default: |
94 | | - 'Ardvark') and an end title (default: 'Goo'). |
95 | | - readIndex <instanceName> <databaseName> Reads data from an example Cloud Spanner table using an existing |
96 | | - index. |
97 | | - readStoringIndex <instanceName> <databaseName> Reads data from an example Cloud Spanner table using an existing |
98 | | - storing index. |
99 | | -
|
100 | | -Options: |
101 | | - --help Show help [boolean] |
102 | | -
|
103 | | -Examples: |
104 | | - node indexing.js createIndex "my-instance" "my-database" |
105 | | - node indexing.js createStoringIndex "my-instance" "my-database" |
106 | | - node indexing.js queryIndex "my-instance" "my-database" |
107 | | - node indexing.js readIndex "my-instance" "my-database" |
108 | | - node indexing.js readStoringIndex "my-instance" "my-database" |
109 | | -
|
110 | | -For more information, see https://cloud.google.com/spanner/docs |
111 | | -``` |
112 | | - |
113 | | -[indexing_2_docs]: https://cloud.google.com/spanner/docs |
114 | | -[indexing_2_code]: indexing.js |
115 | | - |
116 | | -### Transactions |
117 | | - |
118 | | -View the [documentation][transaction_3_docs] or the [source code][transaction_3_code]. |
119 | | - |
120 | | -__Usage:__ `node transaction.js --help` |
121 | | - |
122 | | -``` |
123 | | -Commands: |
124 | | - readOnly <instanceName> <databaseName> Execute a read-only transaction on an example Cloud Spanner table. |
125 | | - readWrite <instanceName> <databaseName> Execute a read-write transaction on an example Cloud Spanner table. |
126 | | -
|
127 | | -Options: |
128 | | - --help Show help [boolean] |
129 | | -
|
130 | | -Examples: |
131 | | - node transaction.js readOnly "my-instance" "my-database" |
132 | | - node transaction.js readWrite "my-instance" "my-database" |
133 | | -
|
134 | | -For more information, see https://cloud.google.com/spanner/docs |
135 | | -``` |
136 | | - |
137 | | -[transaction_3_docs]: https://cloud.google.com/spanner/docs |
138 | | -[transaction_3_code]: transaction.js |
139 | | - |
140 | | -## Running the tests |
| 1 | +Samples for the [Google Cloud Spanner Node.js Client][client] have moved to |
| 2 | +[github.com/googleapis/nodejs-spanner/tree/master/samples/][samples]. |
141 | 3 |
|
| 4 | +[client]: https://github.com/googleapis/nodejs-spanner |
| 5 | +[samples]: https://github.com/googleapis/nodejs-spanner/tree/master/samples |
0 commit comments