fn build_connection_string(role: &str, endpoint: &str, region: &str) -> StringExpand description
Aurora DSQL への接続文字列を構築する
指定されたロール名、エンドポイント、リージョンから PostgreSQL 形式の接続文字列を生成します。
[aurora_dsql_sqlx_connector] がこの文字列を解析して IAM 認証トークンを取得し、
実際のデータベース接続を確立します。
§Arguments
role- データベースロール名(例:"lambda","selectview")endpoint- Aurora DSQL クラスターのエンドポイントホスト名 (例:"abc123.dsql.ap-northeast-1.on.aws")region- Aurora DSQL クラスターが存在する AWS リージョン (例:"ap-northeast-3")
§Returns
PostgreSQL URI 形式の接続文字列。
aurora_dsql_sqlx_connector に渡すことで、IAM 認証が自動的に処理されます。
§Examples
let conn_str = build_connection_string(
"lambda",
"abc123.dsql.ap-northeast-1.on.aws",
"ap-northeast-1"
);
assert_eq!(
conn_str,
"postgres://lambda@abc123.dsql.ap-northeast-1.on.aws/postgres?region=ap-northeast-1"
);