UNPKG

@react-native-ohos/realm

Version:

Realm by MongoDB is an offline-first mobile database: an alternative to SQLite and key-value stores

57 lines 2.44 kB
import { OrderedCollection } from "./OrderedCollection"; import { type SubscriptionOptions } from "./app-services/MutableSubscriptionSet"; import type { Unmanaged } from "./Unmanaged"; /** * Instances of this class are typically **live** collections returned by * objects() that will update as new objects are either * added to or deleted from the Realm that match the underlying query. Results returned by * snapshot()}, however, will **not** live update * (and listener callbacks added through addListener() * will thus never be called). * @see https://www.mongodb.com/docs/realm/sdk/react-native/model-data/data-types/collections/ */ export declare class Results<T = unknown> extends OrderedCollection<T, [ number, T ]> { get length(): number; set length(value: number); description(): string; /** * Bulk update objects in the collection. * @param propertyName - The name of the property. * @param value - The updated property value. * @throws An {@link Error} if no property with the name exists. * @since 2.0.0 */ update(propertyName: keyof Unmanaged<T>, value: Unmanaged<T>[typeof propertyName]): void; /** * Add this query result to the set of active subscriptions. The query will be joined * via an `OR` operator with any existing queries for the same type. * @param options - Options to use when adding this subscription (e.g. a name or wait behavior). * @returns A promise that resolves to this {@link Results} instance. * @experimental This API is experimental and may change or be removed. */ subscribe(options?: SubscriptionOptions): Promise<this>; /** * Unsubscribe from this query result. It returns immediately without waiting * for synchronization. * * If the subscription is unnamed, the subscription matching the query will * be removed. * @experimental This API is experimental and may change or be removed. */ unsubscribe(): void; /** * Checks if this results collection has not been deleted and is part of a valid Realm. * @returns `true` if the collection can be safely accessed. */ isValid(): boolean; /** * Checks if this collection result is empty. * @returns `true` if the collection result is empty, `false` if not. */ isEmpty(): boolean; } export type AnyResults = Results<any>; //# sourceMappingURL=Results.d.ts.map