Interface Collection<T>

Type parameters

  • T = unknown

Hierarchy

Index

Properties

Readonly createdAt

createdAt: Date

In UTC.

Optional Readonly options

Readonly updatedAt

updatedAt: Date | null

In UTC.

Methods

[Symbol.asyncIterator]

  • [Symbol.asyncIterator](): AsyncIterator<T>
  • Enables for-await-of iteration.

    example

    Iterate through a large append log

    // Ensure you import DataPowers
    import { DataPowers, CollectionType, CollectionExpirationMode } from "@andi/powers";
    
    type FiSkillLog = {
        data: string;
    };
    
    const skillLogs = await DataPowers.getOrCreateCollection<FiSkillLog>(CollectionType.Dictionary, "log", { expiry: { expireMode: CollectionExpirationMode.Never } });
    // Sometimes the logs may grow beyond what's performant to load all at once in memory. Use an async iterator to process each log, line by line
    for await (const log of skillLogs) {
        // granular processing
    }

    Returns AsyncIterator<T>

getSize

  • getSize(): Promise<number>
  • Returns Promise<number>

Generated using TypeDoc