firebase-admin.database package

外部 API の再エクスポート

外部で定義された次の API は、このモジュールのエントリ ポイントから再エクスポートされています。

記号 説明
DataSnapshot @firebase/database-compat パッケージの DataSnapshot 型。
イベントタイプ @firebase/database-compat パッケージの EventType 型。
OnDisconnect @firebase/database-compat パッケージの OnDisconnect 型。
クエリ @firebase/database-compat パッケージの Query 型。
リファレンス @firebase/database-compat パッケージの Reference 型。
thenableReference @firebase/database-compat パッケージの ThenableReference 型。

Firebase Realtime Database。

関数

関数 説明
getDatabase(app) デフォルト アプリまたは特定のアプリの Database サービスを取得します。引数なしで getDatabase() を呼び出してデフォルト アプリの Database サービスにアクセスするか、getDatabase(app) として呼び出して、特定のアプリに関連付けられている Database サービスにアクセスできます。
getDatabaseWithUrl(url, app) デフォルト アプリまたは特定のアプリの Database サービスを取得します。引数なしで getDatabaseWithUrl() を呼び出してデフォルト アプリの Database サービスにアクセスするか、getDatabaseWithUrl(app) として呼び出して特定のアプリに関連付けられた Database サービスにアクセスできます。

インターフェース

インターフェース 説明
データベース Firebase Database サービス インターフェース。@firebase/database-compat パッケージが提供する Database インターフェースを拡張します。

変数

変数 説明
enableLogging @firebase/database-compat パッケージの enableLogging 関数を使用します。
ServerValue @firebase/database-compat パッケージの ServerValue 定数。

getDatabase(アプリ)

デフォルト アプリまたは指定されたアプリの Database サービスを取得します。

デフォルト アプリの Database サービスにアクセスするには、引数なしで getDatabase() を呼び出すか、getDatabase(app) として呼び出して特定のアプリに関連付けられている Database サービスにアクセスします。

署名:

export declare function getDatabase(app?: App): Database;

パラメータ

パラメータ 説明
app アプリ

戻り値:

データベース

アプリが指定されていない場合は、デフォルトの Database サービス、または指定されたアプリに関連付けられている Database サービス。

例 1

// Get the Database service for the default app
const defaultDatabase = getDatabase();

例 2

// Get the Database service for a specific app
const otherDatabase = getDatabase(app);

getDatabaseWithUrl(url, app)

デフォルト アプリまたは指定されたアプリの Database サービスを取得します。

デフォルト アプリの Database サービスにアクセスするには引数なしで getDatabaseWithUrl() を呼び出すか、特定のアプリに関連付けられている Database サービスにアクセスするには getDatabaseWithUrl(app) として呼び出します。

署名:

export declare function getDatabaseWithUrl(url: string, app?: App): Database;

パラメータ

パラメータ 説明
URL 文字列
app アプリ

戻り値:

データベース

アプリが指定されていない場合は、デフォルトの Database サービス、または指定されたアプリに関連付けられている Database サービス。

例 1

// Get the Database service for the default app
const defaultDatabase = getDatabaseWithUrl('https://example.firebaseio.com');

例 2

// Get the Database service for a specific app
const otherDatabase = getDatabaseWithUrl('https://example.firebaseio.com', app);

enableLogging

@firebase/database-compat パッケージの enableLogging 関数を使用します。

署名:

enableLogging: typeof rtdb.enableLogging

ServerValue

@firebase/database-compat パッケージの ServerValue 定数。

署名:

ServerValue: rtdb.ServerValue