透過集合功能整理內容
你可以依據偏好儲存及分類內容。
Firebase Data Connect
plat_ios
plat_android
plat_web
plat_flutter
Firebase 推出第一個關聯式資料庫解決方案,適用於希望透過 PostgreSQL 適用的 Cloud SQL 和型別安全的行動和網頁 SDK 建立安全且可擴充應用程式的開發人員。瞭解詳情。
Firebase Data Connect 是行動應用程式和網頁應用程式專用的關聯資料庫服務,可讓您使用由 Cloud SQL 提供的全代管 PostgreSQL 資料庫建構及擴充應用程式。這項服務採用 GraphQL 技術,提供安全的結構定義、查詢和異動管理功能,並能與 Firebase Authentication 完美整合。您可以透過 Kotlin Android、iOS、Flutter 和網頁的 SDK 支援,快速將這項產品整合至行動和網頁應用程式。
Data Connect 可讓您宣告應用程式資料模型,以及應用程式所需的確切查詢。我們會使用您的資料模型,自動建立符合資料模型的 PostgreSQL 資料庫結構定義、與資料庫通訊的安全伺服器端點,以及與伺服器端點通訊的用戶端應用程式型別安全 SDK。這就像為特定應用程式量身打造的「自駕應用程式伺服器」。
主要功能
由 PostgreSQL 適用的 Cloud SQL 提供支援 |
請使用全代管資料庫服務,輕鬆設定、維護及管理 Google Cloud 中的 PostgreSQL 關聯資料庫。 |
向量搜尋 |
Data Connect 支援向量搜尋功能,可協助開發人員建構 AI 輔助應用程式。 |
多平台 SDK |
Firebase Data Connect 提供 Kotlin、Android、iOS、Flutter 和網頁的多平台 SDK。 |
以使用者為基礎的驗證 |
Data Connect 支援使用者驗證,確保只有授權使用者才能存取資料。 |
Visual Studio Code 擴充功能 |
使用 GraphQL,直接透過 Visual Studio Code 編輯器提供簡易的結構定義開發、查詢和異動管理功能。 |
模擬器 |
Firebase Data Connect 包含模擬器,可讓您使用本機資料庫測試應用程式,而無須部署至實際工作環境。 |
Firebase 中的 Gemini AI 協助功能 | 使用 Firebase 中的 Gemini,以自然語言按需產生查詢和突變,並直接在 Firebase 控制台中測試。如要進一步瞭解,請參閱使用 AI assistance for Data Connect 進行查詢和變異。 |
運作原理
Firebase Data Connect 的頂層資源是服務,代表由開發人員定義且可供使用者呼叫的 GraphQL API。結構定義是服務的應用程式資料模型,主要以 GraphQL 來源檔案集合表示,以及已連結資料來源 (例如 Cloud SQL 執行個體) 的特定設定。每項服務只能有一個結構定義。最後,連接器是查詢和變異的集合,這些查詢和變異已定義為針對服務的結構定義運作。每項服務可以有許多連接器 (例如,如果您為共乘車服務公司建立「乘客」應用程式和「司機」應用程式)。
Data Connect 結構定義會明確對應至特定的基礎 PostgreSQL 資料庫結構定義。Data Connect 包含工具,可根據應用程式結構定義的變更,自動產生執行結構定義遷移作業所需的 SQL DDL。Data Connect 會根據應用程式結構定義,自動產生其他 GraphQL 結構定義,用於查詢及操作資料模型。
定義應用程式結構定義後,您就可以編寫預先定義的查詢和變異,執行這些查詢和變異,即可讀取及寫入應用程式中的資料。Data Connect 查詢和變異不會由用戶端程式碼提交,也不會在伺服器上執行。相反地,在部署時,這些 Data Connect 作業會儲存在伺服器上,例如 Cloud Functions。這可簡化程式碼管理和用戶端程式碼的開發作業。在權限環境中 (例如 Firebase 控制台,以及使用 Data Connect VS Code 擴充功能),您可以使用適當的 Google IAM 憑證執行 ad hoc 作業,以便執行管理作業。
針對用戶端程式碼,每個支援的平台都有一個核心 SDK,可處理與後端的連線、發出要求和處理回應。這些 SDK 不支援結構定義,因此必須以非結構化資料的形式提供作業名稱和變數。每個支援的平台也都有產生的 SDK。定義資料模型和作業時,機器上的工具會自動產生應用程式專屬的強型別 SDK。這些 SDK 會「包裝」核心 SDK,提供類型安全性、人因工程學和其他功能,例如資料驗證和日後的其他功能。
實作路徑
|
製作結構定義原型 |
製作資料庫結構定義的原型,包括使用向量類型的設計,並在本機環境中使用工具 |
|
製作作業原型 |
根據自動產生的查詢和異動,為用戶端應用程式建構預先定義的查詢和異動作業 |
|
產生類型安全 SDK |
根據結構定義和作業產生及測試型別安全的 SDK,然後實作用戶端程式碼 |
|
部署結構定義和作業 |
為 Firebase Data Connect 服務部署結構定義和作業 |
|
部署用戶端 |
部署用戶端程式碼 |
後續步驟
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-25 (世界標準時間)。
[null,null,["上次更新時間:2025-07-25 (世界標準時間)。"],[],[],null,["Firebase Data Connect \nplat_ios plat_android plat_web plat_flutter \nFirebase's first relational database solution for\ndevelopers who want to create secure and scalable apps with Cloud SQL for\nPostgreSQL and type-safe mobile and web SDKs. [Learn more](https://firebase.google.com/products/data-connect).\n\nFirebase Data Connect is a relational database service for mobile and web\napps that lets you build and scale using a fully-managed PostgreSQL\ndatabase powered by Cloud SQL. It provides secure schema, query and\nmutation management using GraphQL technology that integrates well with\nFirebase Authentication. You can quickly integrate this product into your mobile and\nweb apps with SDK support in Kotlin Android, iOS, Flutter, and web.\n\nData Connect lets you declare your application's data model and the\nexact queries needed by your application. Using your data model we automatically\ncreate a PostgreSQL database schema to fit your data model, secure server\nendpoints that talk to the database, and type-safe SDKs for your client\napplication that talk to the server endpoints. It's like a \"self-driving app\nserver\" made-to-order for your specific application.\n\nKey capabilities\n\n|---------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Backed by Cloud SQL for PostgreSQL | Rely on a fully-managed database service that helps you set up, maintain, manage, and administer your PostgreSQL relational databases on Google Cloud. |\n| Vector search | Data Connect supports vector search for developers to build AI-powered applications. |\n| Multiple platform SDKs | Firebase Data Connect offers multi-platform SDKs, for Kotlin Android, iOS, Flutter, and web. |\n| User-based authentication | Data Connect supports end-user authentication, ensuring that only authorized users can access the data. |\n| Visual Studio Code extension | Offers easy schema development, and query and mutation management, directly from your Visual Studio Code editor using GraphQL. |\n| Emulator | Firebase Data Connect includes an emulator that lets you test your app with a local database without having to deploy to production. |\n| AI assistance from Gemini in Firebase | Use Gemini in Firebase to generate queries and mutations on-demand using natural language and test them directly in the Firebase console. Learn more at [Use AI assistance for Data Connect for queries and mutations](/docs/data-connect/ai-assistance). |\n\nHow does it work?\n\nThe top-level resource for Firebase Data Connect is a *service* , which\nrepresents a managed GraphQL API that can be defined by developers and called by\nend users. Your *schema* is the app data model for a service, represented\nprimarily as a collection of GraphQL source files, as well as specific\nconfiguration for attached datasources (such as Cloud SQL instances). There can\nbe only one schema per service. Finally, your *connectors* are collections of\nqueries and mutations that have been defined to operate against a service's\nschema. There can be many connectors per service (for instance if you have a\n\"rider\" app and a \"driver\" app for your rideshare company).\n\nYour Data Connect schema maps explicitly to a specific underlying\nPostgreSQL database schema. Data Connect includes tooling to\nautomatically generate the SQL DDL needed to perform schema migrations based on\nchanges to the app schema. Based on your app schema, Data Connect\nautomatically generates additional GraphQL schema to query and manipulate the\ndata model.\n\nOnce your app schema is defined, you can write predefined queries and mutations\nthat are executed to read and write data in the application.\nData Connect queries and mutations are not submitted by client code\nand executed on the server. Instead, when deployed, these Data Connect\noperations are stored on the server, like Cloud Functions. This simplifies code\nmanagement, and development of your client code. In privileged environments,\nlike the Firebase console and using our Data Connect VS Code extension,\nyou can execute ad hoc operations with appropriate Google IAM credentials for\nadministrative operations.\n\nFor client code, each supported platform has a *core SDK* that handles\nconnecting to the backend, issuing requests, and processing responses. These\nSDKs are not schema-aware and must be supplied with operation names and\nvariables as unstructured data. Each supported platform also has a\n*generated SDK*. As you define your data model and operations, tooling on your\nmachine will automatically generate strongly-typed SDKs specific to the\napplication. These SDKs will \"wrap\" the core SDKs for type safety, ergonomics,\nand other features such as data validation and more down the road.\n\nImplementation path\n\n|---|------------------------------|-----------------------------------------------------------------------------------------------------------------------|\n| | Prototype your schema | Prototype your database schema, including designs using vector types, starting in a local environment with tooling |\n| | Prototype your operations | Build predefined query and mutation operations for client apps based on automatically-generated queries and mutations |\n| | Generate type-safe SDKs | Generate and test type-safe SDKs from your schema and operations, then implement client-side code |\n| | Deploy schema and operations | Deploy the schema and operations for your Firebase Data Connect service |\n| | Deploy clients | Deploy your client code |\n\nNext steps\n\n- Try out Data Connect right now: explore a quickstart app repository and build a fully-featured Data Connect app by following our [codelab for web](/codelabs/firebase-dataconnect-web), [codelab for iOS](/codelabs/firebase-dataconnect-ios), or [codelab for Android](/codelabs/firebase-dataconnect-android).\n- If you'd like to see the Firebase Data Connect development flow in action, read through the [Get started guide](/docs/data-connect/quickstart).\n- Learn about Data Connect [pricing and billing](/docs/data-connect/pricing)."]]