prorm API Reference
    Preparing search index...

    Class LevelDBStore

    LevelDBStore wraps a level client and exposes its embedded KV surface: put/get/del for single keys, batch for atomic multi-key writes, and list for ordered key iteration (optionally by prefix).

    Implements

    Index
    name: "leveldb" = 'leveldb'

    The name of the store (e.g. 'mongodb', 'redis', 'dynamodb')

    library: "level" = 'level'

    The client library being used

    • Writes (or overwrites) the value at key.

      Parameters

      • key: string
      • value: unknown

      Returns Promise<void>

    • Reads the value at key.

      Parameters

      • key: string

      Returns Promise<unknown>

    • Deletes the value at key.

      Parameters

      • key: string

      Returns Promise<void>

    • Applies a list of put/del operations as a single atomic batch.

      Parameters

      • ops: LevelDBBatchOp[]

      Returns Promise<void>

    • Lists keys in order. With prefix, restricts to keys >= prefix and < prefix + '\xff' (a standard prefix-scan range for byte-ordered keys).

      Parameters

      • Optionalprefix: string

      Returns Promise<string[]>

    • Ordered iteration over [key, value] pairs whose key is in [gte, lt). Values are returned as stored (JSON strings, when written through the document layer). Used internally by the document layer's range scans.

      Parameters

      • gte: string
      • lt: string

      Returns AsyncIterable<[string, unknown]>

    • Returns a document layer bound to this store, keyed by primaryKey (default 'id'). Exposes the full ORM model API (findAll/findOne/findByPk/create/bulkCreate/update/destroy/ count/truncate/upsert/increment/transaction).

      Parameters

      • primaryKey: string = 'id'

      Returns KvDocumentLayer

    • ORM findAll over a collection: where/order/limit/offset/include.

      Parameters

      • collection: string
      • Optionaloptions: FindOptions

      Returns Promise<Doc[]>

    • ORM findOne over a collection.

      Parameters

      • collection: string
      • Optionaloptions: FindOptions

      Returns Promise<Doc | null>

    • ORM findByPk over a collection.

      Parameters

      • collection: string
      • pk: unknown
      • Optionaloptions: FindOptions

      Returns Promise<Doc | null>

    • ORM count over a collection.

      Parameters

      • collection: string
      • Optionalwhere: WhereClause

      Returns Promise<number>

    • ORM create for a single document.

      Parameters

      • collection: string
      • data: Doc

      Returns Promise<Doc>

    • ORM bulkCreate for many documents (atomic batch).

      Parameters

      • collection: string
      • rows: Doc[]

      Returns Promise<Doc[]>

    • ORM update: merge values into documents matching where.

      Parameters

      • collection: string
      • values: Doc
      • Optionalwhere: WhereClause

      Returns Promise<number>

    • ORM destroy: delete documents matching where.

      Parameters

      • collection: string
      • Optionalwhere: WhereClause

      Returns Promise<number>

    • ORM truncate: delete every document in a collection.

      Parameters

      • collection: string

      Returns Promise<number>

    • Upsert a document by primary key.

      Parameters

      • collection: string
      • data: Doc

      Returns Promise<Doc>

    • Atomically increment numeric fields of one document.

      Parameters

      • collection: string
      • pk: unknown
      • fields: string[] | Record<string, number>

      Returns Promise<Doc | null>

    • Run a function inside an atomic multi-document transaction (single batch commit).

      Type Parameters

      • T

      Parameters

      • fn: (tx: KvTransaction) => Promise<T>

      Returns Promise<T>