palm-pdb
    Preparing search index...

    Class Database<EntryT, RecordT, AppInfoT, SortInfoT>Abstract

    Representation of a Palm OS database file.

    Type Parameters

    • EntryT extends EntryType
    • RecordT extends Record<EntryT>
    • AppInfoT extends Serializable = SBuffer
    • SortInfoT extends Serializable = SBuffer

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    appInfo: null | AppInfoT = null

    AppInfo value.

    appInfoType: null | (new () => AppInfoT) = null

    AppInfo type constructor, to be provided by child classes.

    header: DatabaseHdrType = ...

    Database header.

    Note that appInfoId and sortInfoId fields in the header are overwritten during serialization.

    recordListType: new () => RecordListType<EntryT>

    Record list constructor, to be provided by child classes.

    Type declaration

    records: RecordT[] = []

    Record values.

    Note that entry.localChunkId is overwritten during serialization.

    recordType: new () => RecordT

    Record type constructor, to be provided by child classes.

    Type declaration

      • new (): RecordT
      • Record type constructor, to be provided by child classes.

        Returns RecordT

    sortInfo: null | SortInfoT = null

    SortInfo value.

    sortInfoType: null | (new () => SortInfoT) = null

    SortInfo type constructor, to be provided by child classes.

    Methods

    • Assign properties to this object from a JSON object.

      Conceptually equivalent to Object.assign(), but recursively hydrates SObjects / SArrays / SerializableWrappers etc and invokes their assignJSON() to process JSON values. For example:

      class A extends SObject {
      @field(SUInt8) prop1: number;
      }
      class B extends SObject {
      @field() a = new A();
      }
      const b1 = new B();
      b1.assignJSON({a: {prop1: 300}});

      Parameters

      • jsonObject: { [key: string | symbol]: unknown }

      Returns void

    • Assign properties to this object from a map of Serializables.

      Conceptually equivalent to Object.assign(), but automatically unwraps wrapped properties. Fields defined with @field() are directly assigned, and fields defined with @field(wrapper) are assigned by unwrapping the corresponding SerializableWrapper. Unknown fields are considered an error.

      Parameters

      • serializableMap: { [propertyKey: string | symbol]: Serializable }

      Returns void

    • Parameters

      • buffer: Buffer
      • Optionalopts: DeserializeOptions

      Returns number

    • Parameters

      • Optionalopts: SerializeOptions

      Returns number

    • Recompute offsets in the database and record headers.

      This will update the following based on the current field values:

      • header.appInfoId
      • header.sortInfoId
      • entry.localChunkId for each record

      Parameters

      • Optionalopts: SerializeOptions

      Returns void

    • Parameters

      • Optionalopts: SerializeOptions

      Returns Buffer<ArrayBufferLike>

    • Returns any

    • Map values of this object to Serializable.

      Fields defined with @field() are preserved as-is, and field defined with @field(wrapper) are wrapped in their respective wrapper types.

      Returns { [propertyKey: string]: Serializable }

    • Creates a new instance of this value by deserializing from a buffer.

      Type Parameters

      • T extends Serializable

      Parameters

      • this: new () => T
      • buffer: Buffer
      • Optionalopts: DeserializeOptions

      Returns T

    • Create a new instance with the provided initial properties.

      Type Parameters

      • T extends SObject

      Parameters

      • this: new () => T
      • Optionalprops: Partial<T>

      Returns T

    • Similar to with(), but uses assignJSON() instead of Object.assign().

      Type Parameters

      • T extends SObject

      Parameters

      • this: new () => T
      • json: { [key: string | symbol]: unknown }

      Returns T