Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Interfaces

Functions

Functions

order

  • Creates order query object with given field, ordering method and pagination cursors.

    import { order, query, limit, startAfter, collection } from 'typesaurus'
    
    type Contact = { name: string; year: number }
    const contacts = collection<Contact>('contacts')
    
    query(contacts, [
      order('year', 'asc', [startAfter(2000)]),
      //=> {
      //=>   type: 'order',
      //=>   field: 'year',
      //=>   method: 'asc',
      //=>   cursors: [{ method: 'startAt', value: 2000 }]
      //=> }
      limit(2)
    ]).then(bornAfter2000 => {
      console.log(bornAfter2000)
      //=> 420
    })

    Type parameters

    • Model

    • Key: keyof Model

    Parameters

    • field: Key

      Apply ascending order on given field

    Returns OrderQuery<Model, Key>

    The order query object

  • Creates order query object with given field, ordering method and pagination cursors.

    import { order, query, limit, startAfter, collection } from 'typesaurus'
    
    type Contact = { name: string; year: number }
    const contacts = collection<Contact>('contacts')
    
    query(contacts, [
      order('year', 'asc', [startAfter(2000)]),
      //=> {
      //=>   type: 'order',
      //=>   field: 'year',
      //=>   method: 'asc',
      //=>   cursors: [{ method: 'startAt', value: 2000 }]
      //=> }
      limit(2)
    ]).then(bornAfter2000 => {
      console.log(bornAfter2000)
      //=> 420
    })

    Type parameters

    • Model

    • Key: keyof Model

    Parameters

    Returns OrderQuery<Model, Key>

    The order query object

  • Creates order query object with given field, ordering method and pagination cursors.

    import { order, query, limit, startAfter, collection } from 'typesaurus'
    
    type Contact = { name: string; year: number }
    const contacts = collection<Contact>('contacts')
    
    query(contacts, [
      order('year', 'asc', [startAfter(2000)]),
      //=> {
      //=>   type: 'order',
      //=>   field: 'year',
      //=>   method: 'asc',
      //=>   cursors: [{ method: 'startAt', value: 2000 }]
      //=> }
      limit(2)
    ]).then(bornAfter2000 => {
      console.log(bornAfter2000)
      //=> 420
    })

    Type parameters

    • Model

    • Key: keyof Model

    Parameters

    Returns OrderQuery<Model, Key>

    The order query 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