Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Interfaces

Type aliases

Functions

Type aliases

CollectionEntity

CollectionEntity<Model>: Collection<Model> | Subcollection<Model, any>

Type parameters

  • Model

Functions

group

  • Creates a collection group object.

    import { group, subcollection, collection, ref } from 'typesaurus'
    
    type User = { name: string }
    type Company = { name: string; address: string }
    type Post = { author: Ref<User>; text: string; date?: Date }
    const users = collection<User>('users')
    const companies = collection<Company>('companies')
    const posts = collection<Post>('posts')
    const userPosts = subcollection<Post, User>('posts', users)
    const companyPosts = subcollection<Post, User>('posts', companies)
    
    const allPosts = group('posts', [posts, userPosts, companyPosts])
    //=> { __type__: 'collectionGroup', path: 'posts' }
    
    query(allPosts, [where('author', '==', ref(users, '00sHm46UWKObv2W7XK9e'))])
    //=> Promise<Post[]>

    Type parameters

    • A

    Parameters

    • path: string
    • collections: [CollectionEntity<A>]

      The collections to create group from.

    Returns CollectionGroup<A>

  • Creates a collection group object.

    import { group, subcollection, collection, ref } from 'typesaurus'
    
    type User = { name: string }
    type Company = { name: string; address: string }
    type Post = { author: Ref<User>; text: string; date?: Date }
    const users = collection<User>('users')
    const companies = collection<Company>('companies')
    const posts = collection<Post>('posts')
    const userPosts = subcollection<Post, User>('posts', users)
    const companyPosts = subcollection<Post, User>('posts', companies)
    
    const allPosts = group('posts', [posts, userPosts, companyPosts])
    //=> { __type__: 'collectionGroup', path: 'posts' }
    
    query(allPosts, [where('author', '==', ref(users, '00sHm46UWKObv2W7XK9e'))])
    //=> Promise<Post[]>

    Type parameters

    • A

    • B

    Parameters

    Returns CollectionGroup<A | B>

  • Creates a collection group object.

    import { group, subcollection, collection, ref } from 'typesaurus'
    
    type User = { name: string }
    type Company = { name: string; address: string }
    type Post = { author: Ref<User>; text: string; date?: Date }
    const users = collection<User>('users')
    const companies = collection<Company>('companies')
    const posts = collection<Post>('posts')
    const userPosts = subcollection<Post, User>('posts', users)
    const companyPosts = subcollection<Post, User>('posts', companies)
    
    const allPosts = group('posts', [posts, userPosts, companyPosts])
    //=> { __type__: 'collectionGroup', path: 'posts' }
    
    query(allPosts, [where('author', '==', ref(users, '00sHm46UWKObv2W7XK9e'))])
    //=> Promise<Post[]>

    Type parameters

    • A

    • B

    • C

    Parameters

    Returns CollectionGroup<A | B | C>

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