firestore-indexes
TypeScript icon, indicating that this package has built-in type declarations

3.0.2 • Public • Published

firestore-indexes

firestore-indexes is a tiny helper class which helps you write indexes for Firestore using Typescript and lets you generate the corresponding firestore-indexes.json file during your build process

Install

npm install firestore-indexes

Usage

import {IndexManager, QueryScope} from 'firestore-indexes';

interface User {
  name: string;
  registeredAt: Date;
  address: {
    street: string;
    zip: number
  }
}

export const indexManager = new IndexManager()
  .addIndex<User>('users', QueryScope.Collection)
  /**/.field('name')
  /**/.field(u => u.address.street)
  /**/.add()
  .addIndex<User>('users', QueryScope.Collection)
  /**/.field('address.city')
  /**/.field('address.zip')
  /**/.add()

Readme

Keywords

none

Package Sidebar

Install

npm i firestore-indexes

Weekly Downloads

7

Version

3.0.2

License

MIT

Unpacked Size

18.8 kB

Total Files

19

Last publish

Collaborators

  • dominicbartl