Bagikan melalui


Offers class

Gunakan untuk mengkueri atau membaca semua Penawaran.

Lihat Penawaran untuk membaca atau mengganti Penawaran yang ada berdasarkan id.

Properti

client

Metode

query(SqlQuerySpec, FeedOptions)

Kueri semua penawaran.

Contoh

Baca penawaran untuk id tertentu.

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)

Kueri semua penawaran.

readAll(FeedOptions)

Baca semua penawaran.

Contoh

Baca semua penawaran ke array.

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

Detail Properti

client

client: CosmosClient

Nilai Properti

Detail Metode

query(SqlQuerySpec, FeedOptions)

Kueri semua penawaran.

Contoh

Baca penawaran untuk id tertentu.

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

Konfigurasi kueri untuk operasi. Lihat SqlQuerySpec untuk informasi selengkapnya tentang cara mengonfigurasi kueri.

options
FeedOptions

Mengembalikan

query<T>(SqlQuerySpec, FeedOptions)

Kueri semua penawaran.

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

Parameter

query
SqlQuerySpec

Konfigurasi kueri untuk operasi. Lihat SqlQuerySpec untuk informasi selengkapnya tentang cara mengonfigurasi kueri.

options
FeedOptions

Mengembalikan

readAll(FeedOptions)

Baca semua penawaran.

Contoh

Baca semua penawaran ke array.

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

Mengembalikan