Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Functions

Functions

batch

  • batch(): object
  • Creates batch API ({@link set}, update, {@link remove}) but unlike regular functions do not return promise and perform operations only when commit function is called.

    import { batch, collection } from 'typesaurus'
    
    type Counter = { count: number }
    const counters = collection<Counter>('counters')
    
    const { set, update, remove, commit } = batch()
    
    for (let count = 0; count < 500; count++) {
      // Each batch can be up to 500 set, update and remove operations
      set(counters, count.toString(), { count })
    }
    
    // Set 500 documents
    commit().then(() => console.log('Done!'))

    Returns object

    Batch API (set, update, remove, commit)

    • clear: remove
    • commit: commit
    • remove: remove
    • set: set
    • update: update

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc