faucet-common-spanner
Shared configuration and conversion types for the
faucet-stream Google Cloud
Spanner connectors — faucet-source-spanner
and faucet-sink-spanner.
Both connectors re-export these types, so you normally depend on the source or sink crate rather than this one directly.
Contents
-
SpannerCredentials— the auth enum, serialized in faucet's consistent{ type: <method>, config: { … } }wire shape:typeFields Meaning application_default— Application Default Credentials ( GOOGLE_APPLICATION_CREDENTIALS,gcloud auth application-default login, GCE/GKE metadata) — the defaultservice_account_key_pathpathService-account key JSON loaded from a file service_account_keyjsonInline service-account key JSON — prefer ${vault:…}/${env:…}interpolation over literals;Debugmasks it -
SpannerConnection— the flattened connection block shared by both connector configs:project_id/instance/database/auth/max_sessions(session-pool bound; channels sized at one per 100 sessions) /emulator_host(per-connector emulator override — the process-globalSPANNER_EMULATOR_HOSTenv var is also honored when unset). Providesconnect()(data-plane client) andconnect_admin()(DDL/instance admin client) plusdatabase_path(). -
types—parse_spanner_type(INFORMATION_SCHEMAtype strings →SpannerType, includingARRAY<…>) andspanner_type_to_json_schema. -
decode— generic Spanner row →serde_json::Valuedecoding for arbitrary queries: INT64 stays a lossless JSON integer, NUMERIC stays a string, JSON columns parse to structured values, BYTES stay base64, ARRAY/STRUCT recurse. -
encode—serde_json::Value→ mutation value encoding keyed by the destination column type, with typed mismatch errors.
License
MIT OR Apache-2.0