# Google Spanner

> 英文标题：Google Spanner
> 官网原文：https://typeorm.io/docs/drivers/google-spanner
> 文档版本：TypeORM v1.1
> 体例：英文原文（EN）与中文译文（ZH）逐块并列，共 11 块

---

<!-- EN -->
# Google Spanner

<!-- ZH -->
# Google Spanner

<!-- EN -->
## Installation

<!-- ZH -->
## 安装

<!-- EN -->
```shell
npm install @google-cloud/spanner
```

<!-- ZH -->
```shell
npm install @google-cloud/spanner
```

<!-- EN -->
## Data Source Options

<!-- ZH -->
## 数据源选项

<!-- EN -->
See [Data Source Options](https://typeorm.io/docs/data-source/data-source-options) for the common data source options.

<!-- ZH -->
通用数据源选项请参阅[数据源选项](https://typeorm.io/docs/data-source/data-source-options)。

<!-- EN -->
Provide authentication credentials to your application code by setting the environment variable `GOOGLE_APPLICATION_CREDENTIALS`:

<!-- ZH -->
通过设置环境变量 `GOOGLE_APPLICATION_CREDENTIALS` 向你的应用代码提供认证凭据：

<!-- EN -->
```shell
# Linux/macOS
export GOOGLE_APPLICATION_CREDENTIALS="KEY_PATH"

# Windows
set GOOGLE_APPLICATION_CREDENTIALS=KEY_PATH

# Replace KEY_PATH with the path of the JSON file that contains your service account key.
```

<!-- ZH -->
```shell
# Linux/macOS
export GOOGLE_APPLICATION_CREDENTIALS="KEY_PATH"

# Windows
set GOOGLE_APPLICATION_CREDENTIALS=KEY_PATH

# 把 KEY_PATH 替换为包含服务账号密钥的 JSON 文件路径。
```

<!-- EN -->
To use Spanner with the emulator you should set `SPANNER_EMULATOR_HOST` environment variable:

<!-- ZH -->
要在模拟器中使用 Spanner，你应当设置 `SPANNER_EMULATOR_HOST` 环境变量：

<!-- EN -->
```shell
# Linux/macOS
export SPANNER_EMULATOR_HOST=localhost:9010

# Windows
set SPANNER_EMULATOR_HOST=localhost:9010
```

<!-- ZH -->
```shell
# Linux/macOS
export SPANNER_EMULATOR_HOST=localhost:9010

# Windows
set SPANNER_EMULATOR_HOST=localhost:9010
```

<!-- EN -->
## Column Types

<!-- ZH -->
## 列类型

<!-- EN -->
`bool`, `int64`, `float64`, `numeric`, `string`, `json`, `bytes`, `date`, `timestamp`, `array`

<!-- ZH -->
`bool`、`int64`、`float64`、`numeric`、`string`、`json`、`bytes`、`date`、`timestamp`、`array`
