docs(spanner): clarify how to set paramters

- include param in DSN example
- link to README docs on param (option) format
- switch to 'parameter' instead of 'option', in the main README, since
this is preferred
This commit is contained in:
William Yardley
2020-08-16 05:40:20 -07:00
parent 38825ee1eb
commit a7b7869485
2 changed files with 7 additions and 6 deletions
+1 -1
View File
@@ -41,7 +41,7 @@ Database drivers run migrations. [Add a new database?](database/driver.go)
### Database URLs
Database connection strings are specified via URLs. The URL format is driver dependent but generally has the form: `dbdriver://username:password@host:port/dbname?option1=true&option2=false`
Database connection strings are specified via URLs. The URL format is driver dependent but generally has the form: `dbdriver://username:password@host:port/dbname?param1=true&param2=false`
Any [reserved URL characters](https://en.wikipedia.org/wiki/Percent-encoding#Percent-encoding_reserved_characters) need to be escaped. Note, the `%` character also [needs to be escaped](https://en.wikipedia.org/wiki/Percent-encoding#Percent-encoding_the_percent_character)
+6 -5
View File
@@ -2,12 +2,14 @@
## Usage
See [Google Spanner Documentation](https://cloud.google.com/spanner/docs) for
more details.
The DSN must be given in the following format.
`spanner://projects/{projectId}/instances/{instanceId}/databases/{databaseName}`
See [Google Spanner Documentation](https://cloud.google.com/spanner/docs) for details.
`spanner://projects/{projectId}/instances/{instanceId}/databases/{databaseName}?param=true`
as described in [README.md#database-urls](../../README.md#database-urls)
| Param | WithInstance Config | Description |
| ----- | ------------------- | ----------- |
@@ -18,7 +20,6 @@ See [Google Spanner Documentation](https://cloud.google.com/spanner/docs) for de
| `instanceId` || The id of the instance running Spanner
| `databaseName` || The name of the Spanner database
> **Note:** Google Cloud Spanner migrations can take a considerable amount of
> time. The migrations provided as part of the example take about 6 minutes to
> run on a small instance.
@@ -42,4 +43,4 @@ In order to be able to use more than 1 DDL statement in the same migration file,
To unit test the `spanner` driver, `SPANNER_DATABASE` needs to be set. You'll
need to sign-up to Google Cloud Platform (GCP) and have a running Spanner
instance since it is not possible to run Google Spanner outside GCP.
instance since it is not possible to run Google Spanner outside GCP.