コンテンツにジャンプ

Firebase Firestore __CAPGO_KEEP_0__ リポジトリ

GitHub

AI-Assisted セットアップを使用してプラグインをインストールできます。AI ツールに Capgo スキルを追加するには、以下のコマンドを実行してください。

ターミナル画面
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins

次に、以下のコマンドを使用してください:

Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-firebase-firestore` plugin in my project.

手動設定を使用する場合は、以下のコマンドを実行してプラグインをインストールし、以下のプラットフォーム固有の指示に従ってください。

ターミナル画面
bun add @capgo/capacitor-firebase-firestore
bunx cap sync
import { FirebaseFirestore } from '@capgo/capacitor-firebase-firestore';

指定されたデータでコレクションに新しいドキュメントを追加します。

import { FirebaseFirestore } from '@capgo/capacitor-firebase-firestore';
await FirebaseFirestore.addDocument({} as AddDocumentOptions);

指定された参照で参照されるドキュメントに書き込みます。 ドキュメントがまだ存在しない場合、作成されます。

import { FirebaseFirestore } from '@capgo/capacitor-firebase-firestore';
await FirebaseFirestore.setDocument({} as SetDocumentOptions);

指定された参照で参照されるドキュメントを読み取ります。

import { FirebaseFirestore } from '@capgo/capacitor-firebase-firestore';
await FirebaseFirestore.getDocument({} as GetDocumentOptions);

指定された参照で参照されるドキュメントのフィールドを更新します。

import { FirebaseFirestore } from '@capgo/capacitor-firebase-firestore';
await FirebaseFirestore.updateDocument({} as UpdateDocumentOptions);

指定された参照に基づいてドキュメントを削除します。

import { FirebaseFirestore } from '@capgo/capacitor-firebase-firestore';
await FirebaseFirestore.deleteDocument({} as DeleteDocumentOptions);

指定された参照に基づいてバッチ内で複数の書き込み操作を実行します。

import { FirebaseFirestore } from '@capgo/capacitor-firebase-firestore';
await FirebaseFirestore.writeBatch({} as WriteBatchOptions);

指定された参照に基づいてコレクションを読み取ります。

import { FirebaseFirestore } from '@capgo/capacitor-firebase-firestore';
await FirebaseFirestore.getCollection({} as GetCollectionOptions);

指定された参照に基づいてコレクション グループを読み取ります。

import { FirebaseFirestore } from '@capgo/capacitor-firebase-firestore';
await FirebaseFirestore.getCollectionGroup({} as GetCollectionGroupOptions);

getCountFromServer

getCountFromServer

コレクション内のドキュメントの数を取得します。

import { FirebaseFirestore } from '@capgo/capacitor-firebase-firestore';
await FirebaseFirestore.getCountFromServer({} as GetCountFromServerOptions);

clearPersistence

clearPersistence

パーシステンスストレージをクリアします。これには、保留中の書き込みとキャッシュされたドキュメントも含まれます。

アプリが終了した後またはアプリが初めて初期化された後には、必ず呼び出してください。

import { FirebaseFirestore } from '@capgo/capacitor-firebase-firestore';
await FirebaseFirestore.clearPersistence();

enableNetwork

enableNetwork

ネットワークの使用を再度有効にします。

import { FirebaseFirestore } from '@capgo/capacitor-firebase-firestore';
await FirebaseFirestore.enableNetwork();

disableNetwork

disableNetwork

ネットワークの使用を無効にします。

import { FirebaseFirestore } from '@capgo/capacitor-firebase-firestore';
await FirebaseFirestore.disableNetwork();

アプリをインストルメントして、Firestore エミュレータとコミュニケーションをとる。

import { FirebaseFirestore } from '@capgo/capacitor-firebase-firestore';
await FirebaseFirestore.useEmulator({} as UseEmulatorOptions);

ドキュメント スナップショット イベントのリスナーを追加します。

import { FirebaseFirestore } from '@capgo/capacitor-firebase-firestore';
await FirebaseFirestore.addDocumentSnapshotListener({} as AddDocumentSnapshotListenerOptions, {} as AddDocumentSnapshotListenerCallback<T>);

コレクション スナップショット イベントのリスナーを追加します。

import { FirebaseFirestore } from '@capgo/capacitor-firebase-firestore';
await FirebaseFirestore.addCollectionSnapshotListener({} as AddCollectionSnapshotListenerOptions, {} as AddCollectionSnapshotListenerCallback<T>);

コレクション グループ スナップショット イベントのリスナーを追加します。

import { FirebaseFirestore } from '@capgo/capacitor-firebase-firestore';
await FirebaseFirestore.addCollectionGroupSnapshotListener({} as AddCollectionGroupSnapshotListenerOptions, {} as AddCollectionGroupSnapshotListenerCallback<T>);

removeSnapshotListener

__CAPGO_KEEP_1__

__CAPGO_KEEP_2__

import { FirebaseFirestore } from '@capgo/capacitor-firebase-firestore';
await FirebaseFirestore.removeSnapshotListener({} as RemoveSnapshotListenerOptions);

__CAPGO_KEEP_3__

__CAPGO_KEEP_4__

AddDocumentOptions

__CAPGO_KEEP_5__
export interface AddDocumentOptions {
/**
* The reference as a string, with path components separated by a forward slash (`/`).
*
* @since 5.2.0
* @example 'users'
*/
reference: string;
/**
* An object containing the data for the new document.
*
* @since 5.2.0
* @example { first: 'Alan', last: 'Turing', born: 1912 }
*/
data: DocumentData;
}

AddDocumentResult

__CAPGO_KEEP_6__
export interface AddDocumentResult {
/**
* The reference of the newly added document.
*
* @since 5.2.0
*/
reference: DocumentReference;
}

SetDocumentOptions

__CAPGO_KEEP_7__
export interface SetDocumentOptions {
/**
* The reference as a string, with path components separated by a forward slash (`/`).
*
* @since 5.2.0
* @example 'users/Aorq09lkt1ynbR7xhTUx'
*/
reference: string;
/**
* An object containing the data for the new document.
*
* @since 5.2.0
* @example { first: 'Alan', last: 'Turing', born: 1912 }
*/
data: DocumentData;
/**
* Whether to merge the provided data with an existing document.
*
* @since 5.2.0
* @example true
* @default false
*/
merge?: boolean;
}
export interface DocumentData {
/**
* A mapping between a field and its value.
*
* @since 5.2.0
*/
[field: string]: any;
}
export interface GetDocumentOptions {
/**
* The reference as a string, with path components separated by a forward slash (`/`).
*
* @since 5.2.0
*/
reference: string;
}
export interface GetDocumentResult<T> {
/**
* The current document contents.
*
* @since 5.2.0
*/
snapshot: DocumentSnapshot<T>;
}
export interface UpdateDocumentOptions {
/**
* The reference as a string, with path components separated by a forward slash (`/`).
*
* @since 5.2.0
*/
reference: string;
/**
* An object containing the data for the new document.
*
* @since 5.2.0
* @example { first: 'Alan', last: 'Turing', born: 1912 }
*/
data: DocumentData;
}
export interface DeleteDocumentOptions {
/**
* The reference as a string, with path components separated by a forward slash (`/`).
*
* @since 5.2.0
*/
reference: string;
}
export interface WriteBatchOptions {
/**
* The operations to execute in the batch.
*
* @since 6.1.0
*/
operations: WriteBatchOperation[];
}
export interface GetCollectionOptions {
/**
* The reference as a string, with path components separated by a forward slash (`/`).
*
* @since 5.2.0
*/
reference: string;
/**
* The filter to apply.
*
* @since 5.2.0
*/
compositeFilter?: QueryCompositeFilterConstraint;
/**
* Narrow or order the set of documents to retrieve, but do not explicitly filter for document fields.
*
* @since 5.2.0
*/
queryConstraints?: QueryNonFilterConstraint[];
}
export interface GetCollectionResult<T> {
/**
* The documents in the collection.
*
* @since 5.2.0
*/
snapshots: DocumentSnapshot<T>[];
}
export interface GetCollectionGroupOptions {
/**
* The reference as a string, with path components separated by a forward slash (`/`).
*
* @since 5.2.0
*/
reference: string;
/**
* The filter to apply.
*
* @since 5.2.0
*/
compositeFilter?: QueryCompositeFilterConstraint;
/**
* Narrow or order the set of documents to retrieve, but do not explicitly filter for document fields.
*
* @since 5.2.0
*/
queryConstraints?: QueryNonFilterConstraint[];
}

このページはプラグインの設定から生成されています。 src/definitions.tsパブリック API がアップストリームで変更された場合に再度同期を実行してください。

あなたが使用している場合 はじめに ダッシュボードとAPIの操作を計画するには、APIに接続してください。 APIの概要 APIの概要の実装詳細については、 導入 導入の実装詳細については、 APIのキー APIのキーについての実装詳細は、 デバイス デバイスについての実装詳細は、 バンドル __CAPGO_KEEP_0__の実装詳細については、Bundlesの詳細を参照してください。