Aracılığıyla paylaş


Offers class

Tüm Teklifleri sorgulamak veya okumak için kullanın.

Mevcut Teklifi kimliğe göre okumak veya değiştirmek için bkz. teklif .

Özellikler

client

Yöntemler

query(SqlQuerySpec, FeedOptions)

Tüm teklifleri sorgula.

Örnek

Belirli bir kimlik için teklifi okuyun.

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();
query<T>(SqlQuerySpec, FeedOptions)

Tüm teklifleri sorgula.

readAll(FeedOptions)

Tüm teklifleri okuyun.

Örnek

Diziye yapılan tüm teklifleri okuyun.

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();

Özellik Ayrıntıları

client

client: CosmosClient

Özellik Değeri

Yöntem Ayrıntıları

query(SqlQuerySpec, FeedOptions)

Tüm teklifleri sorgula.

Örnek

Belirli bir kimlik için teklifi okuyun.

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>

Parametreler

query
SqlQuerySpec

İşlem için sorgu yapılandırması. Sorgu yapılandırma hakkında daha fazla bilgi için bkz. SqlQuerySpec.

options
FeedOptions

Döndürülenler

query<T>(SqlQuerySpec, FeedOptions)

Tüm teklifleri sorgula.

function query<T>(query: SqlQuerySpec, options?: FeedOptions): QueryIterator<T>

Parametreler

query
SqlQuerySpec

İşlem için sorgu yapılandırması. Sorgu yapılandırma hakkında daha fazla bilgi için bkz. SqlQuerySpec.

options
FeedOptions

Döndürülenler

readAll(FeedOptions)

Tüm teklifleri okuyun.

Örnek

Diziye yapılan tüm teklifleri okuyun.

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>

Parametreler

options
FeedOptions

Döndürülenler