Google Spanner
安装
npm install @google-cloud/spanner数据源选项
通用数据源选项请参阅数据源选项。
通过设置环境变量 GOOGLE_APPLICATION_CREDENTIALS 向你的应用代码提供认证凭据:
# Linux/macOS
export GOOGLE_APPLICATION_CREDENTIALS="KEY_PATH"
# Windows
set GOOGLE_APPLICATION_CREDENTIALS=KEY_PATH
# 把 KEY_PATH 替换为包含服务账号密钥的 JSON 文件路径。要在模拟器中使用 Spanner,你应当设置 SPANNER_EMULATOR_HOST 环境变量:
# Linux/macOS
export SPANNER_EMULATOR_HOST=localhost:9010
# Windows
set SPANNER_EMULATOR_HOST=localhost:9010列类型
bool、int64、float64、numeric、string、json、bytes、date、timestamp、array
Installation
npm install @google-cloud/spannerData Source Options
See Data Source Options for the common data source options.
Provide authentication credentials to your application code by setting the environment variable GOOGLE_APPLICATION_CREDENTIALS:
# 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.To use Spanner with the emulator you should set SPANNER_EMULATOR_HOST environment variable:
# Linux/macOS
export SPANNER_EMULATOR_HOST=localhost:9010
# Windows
set SPANNER_EMULATOR_HOST=localhost:9010Column Types
bool, int64, float64, numeric, string, json, bytes, date, timestamp, array