Offers class
Eigenschaften
| client |
Methoden
| query(Sql |
Fragen Sie alle Angebote ab. Beispiel Lesen Sie das Angebot für eine bestimmte ID.
|
| query<T>(Sql |
Fragen Sie alle Angebote ab. |
| read |
Alle Angebote lesen. Beispiel Alle Angebote für Array lesen.
|
Details zur Eigenschaft
client
Details zur Methode
query(SqlQuerySpec, FeedOptions)
Fragen Sie alle Angebote ab.
Beispiel
Lesen Sie das Angebot für eine bestimmte ID.
import { CosmosClient, SqlQuerySpec } from "@azure/cosmos";
const endpoint = "https://your-account.documents.azure.com";
const key = "<database account masterkey>";
const client = new CosmosClient({ endpoint, key });
const querySpec: SqlQuerySpec = {
query: `SELECT * FROM root r WHERE r.id = @offer`,
parameters: [{ name: "@offer", value: "<offer-id>" }],
};
const { resources: offer } = await client.offers.query(querySpec).fetchAll();
function query(query: SqlQuerySpec, options?: FeedOptions): QueryIterator<any>
Parameter
- query
- SqlQuerySpec
Abfragekonfiguration für den Vorgang. Weitere Informationen zum Konfigurieren einer Abfrage finden Sie unter SqlQuerySpec-.
- options
- FeedOptions
Gibt zurück
QueryIterator<any>
query<T>(SqlQuerySpec, FeedOptions)
Fragen Sie alle Angebote ab.
function query<T>(query: SqlQuerySpec, options?: FeedOptions): QueryIterator<T>
Parameter
- query
- SqlQuerySpec
Abfragekonfiguration für den Vorgang. Weitere Informationen zum Konfigurieren einer Abfrage finden Sie unter SqlQuerySpec-.
- options
- FeedOptions
Gibt zurück
readAll(FeedOptions)
Alle Angebote lesen.
Beispiel
Alle Angebote für Array lesen.
import { CosmosClient } from "@azure/cosmos";
const endpoint = "https://your-account.documents.azure.com";
const key = "<database account masterkey>";
const client = new CosmosClient({ endpoint, key });
const { resources: offerList } = await client.offers.readAll().fetchAll();
function readAll(options?: FeedOptions): QueryIterator<OfferDefinition & Resource>
Parameter
- options
- FeedOptions