Skip to content

@gala-chain/chaincodeAPI


API > getObjectsByPartialCompositeKeyWithPagination

Function: getObjectsByPartialCompositeKeyWithPagination()

getObjectsByPartialCompositeKeyWithPagination\<T>(ctx, objectType, attributes, constructor, bookmark, limit): Promise\<object>

Type parameters

T extends ChainObject

Parameters

ctx: GalaChainContext

objectType: string

attributes: string[]

constructor: ClassConstructor\<Inferred\<T, ChainObject>>

bookmark: undefined | string

limit: number= TOTAL_RESULTS_LIMIT

Returns

Promise of an Object containing two properties: results: Array of Chain Objects deserialized using the provided constructor, metadata: QueryResponseMetadata

Description

Query Chain Objects by Partial Composite Key. Refer to class definitions for types that extend ChainObject to determine property names and order of the @ChainKey composite parts.

Paginated version. Use cases that expect large numbers of results can use this method to page through results. Cannot be used in SUBMIT transactions.

Remarks

The @ChainKeys that make up the World State composite keys are ordered, and cannot be skipped when making partial composite key queries. Be advised that broad queries can lead to performance issues for large result sets. Tune page size using the limit property accordingly.

Source

chaincode/src/utils/state.ts:191