Offers class
Vlastnosti
| client |
Metody
| query(Sql |
Zadejte dotaz na všechny nabídky. příklad Přečtěte si nabídku pro konkrétní ID.
|
| query<T>(Sql |
Zadejte dotaz na všechny nabídky. |
| read |
Přečtěte si všechny nabídky. příklad Čtení všech nabídek do pole
|
Podrobnosti vlastnosti
client
Podrobnosti metody
query(SqlQuerySpec, FeedOptions)
Zadejte dotaz na všechny nabídky.
příklad
Přečtěte si nabídku pro konkrétní 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>
Parametry
- query
- SqlQuerySpec
Konfigurace dotazu pro operaci. Další informace o konfiguraci dotazu najdete v tématu sqlQuerySpec.
- options
- FeedOptions
Návraty
QueryIterator<any>
query<T>(SqlQuerySpec, FeedOptions)
Zadejte dotaz na všechny nabídky.
function query<T>(query: SqlQuerySpec, options?: FeedOptions): QueryIterator<T>
Parametry
- query
- SqlQuerySpec
Konfigurace dotazu pro operaci. Další informace o konfiguraci dotazu najdete v tématu sqlQuerySpec.
- options
- FeedOptions
Návraty
readAll(FeedOptions)
Přečtěte si všechny nabídky.
příklad
Čtení všech nabídek do pole
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>
Parametry
- options
- FeedOptions