gis-tools-ts - v0.6.0
    Preparing search index...

    Class MMapMultiMap<V>

    MultiMap MMap Store

    A mmap multimap store

    import { MMapMultiMap } from 'gis-tools-ts/mmap';

    interface Data { name: string };

    const mm = new FileMultiMap<Data>();
    // set a key
    mm.set(1n, { name: 'test' });
    mm.set(1n, { name: 'test2' });
    // get a key
    const { name } = mm.get(1n); // [{ name: 'test' }, { name: 'test2' }]
    // check if a key exists
    mm.has(1n); // true
    // get length of the store
    console.log(mm.length); // 2

    // iterate over the store
    for await (const entry of mm) console.log(entry);

    // close the store
    mm.close();

    Type Parameters

    • V = Properties | Value

    Implements

    Index

    Constructors

    Accessors

    Methods

    Constructors

    • Builds a new MultiMap file store

      Type Parameters

      • V = Value | Properties

      Parameters

      • OptionalfileName: string

        the path + file name without the extension

      Returns MMapMultiMap<V>

    Accessors

    • get length(): number

      Returns number

      • the length of the map

    Methods

    • iterate through the values

      Returns AsyncGenerator<MMEntry<V>>

      • an iterator
    • Closes the store

      Returns void

    • iterate through the values

      Returns AsyncGenerator<MMEntry<V>>

      • The values in the store
    • Gets the list of values associated with a key

      Parameters

      • key: number | bigint

        the key

      Returns Promise<undefined | V[]>

      the list of values if the map contains values for the key

    • Check if the key exists

      Parameters

      • key: number | bigint

        the key

      Returns Promise<boolean>

      true if the key exists

    • Adds a value to the list of values associated with a key

      Parameters

      • key: number | bigint

        the key

      • value: V

        the value to store

      Returns void