Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Interfaces

Type aliases

Functions

Type aliases

CursorMethod

CursorMethod: "startAfter" | "startAt" | "endBefore" | "endAt"

Available cursor methods.

Functions

endAt

  • endAt<Model, Key>(value: Model[Key] | Doc<Model> | undefined): Cursor<Model, Key>
  • Ends the query results on the given value.

    import { endAt, order, query, collection } from 'typesaurus'
    
    type Contact = { name: string; year: number }
    const contacts = collection<Contact>('contacts')
    
    query(contacts, [order('year', 'asc', [endAt(1999)])])
      .then(olderThan2K => {
        console.log(olderThan2K.length)
        //=> 420
      })

    Type parameters

    • Model

    • Key: keyof Model

    Parameters

    • value: Model[Key] | Doc<Model> | undefined

      The value to end the query results at

    Returns Cursor<Model, Key>

    The cursor object

endBefore

  • endBefore<Model, Key>(value: Model[Key] | Doc<Model> | undefined): Cursor<Model, Key>
  • Ends the query results before the given value.

    import { endBefore, order, query, collection } from 'typesaurus'
    
    type Contact = { name: string; year: number }
    const contacts = collection<Contact>('contacts')
    
    query(contacts, [order('year', 'asc', [endBefore(2000)])])
      .then(olderThan2K => {
        console.log(olderThan2K.length)
        //=> 420
      })

    Type parameters

    • Model

    • Key: keyof Model

    Parameters

    • value: Model[Key] | Doc<Model> | undefined

      The value to end the query results before

    Returns Cursor<Model, Key>

    The cursor object

startAfter

  • startAfter<Model, Key>(value: Model[Key] | Doc<Model> | undefined): Cursor<Model, Key>
  • Start the query results after the given value.

    import { startAfter, order, query, collection } from 'typesaurus'
    
    type Contact = { name: string; year: number }
    const contacts = collection<Contact>('contacts')
    
    query(contacts, [order('year', 'asc', [startAfter(1999)])])
      .then(youngerThan2K => {
        console.log(youngerThan2K.length)
        //=> 420
      })

    Type parameters

    • Model

    • Key: keyof Model

    Parameters

    • value: Model[Key] | Doc<Model> | undefined

      The value to end the query results after

    Returns Cursor<Model, Key>

    The cursor object

startAt

  • startAt<Model, Key>(value: Model[Key] | Doc<Model> | undefined): Cursor<Model, Key>
  • Start the query results on the given value.

    import { startAt, order, query, collection } from 'typesaurus'
    
    type Contact = { name: string; year: number }
    const contacts = collection<Contact>('contacts')
    
    query(contacts, [order('year', 'asc', [startAt(2000)])])
      .then(youngerThan2K => {
        console.log(youngerThan2K.length)
        //=> 420
      })

    Type parameters

    • Model

    • Key: keyof Model

    Parameters

    • value: Model[Key] | Doc<Model> | undefined

      The value to start the query results at

    Returns Cursor<Model, Key>

    The cursor object

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