@sensenet/query
    TypeScript icon, indicating that this package has built-in type declarations

    2.1.2 • Public • Published

    @sensenet/query

    NPM version NPM downloads License: GPL v2

    Install

    # Yarn
    yarn add @sensenet/query
    
    # NPM
    npm install @sensenet/query

    Usage

    The package allows you to create strongly typed content queries that will be evaluated into sensenet queries

    Usage example:

    const query = new Query(
      (q) =>
        q
          .typeIs<Task>('Task') // adds '+TypeIs:Task' and Typescript type cast
          .and.equals('DisplayName', 'Unicorn') // adds +Title:Unicorn
          .and.between('ModificationDate', '2017-01-01T00:00:00', '2017-02-01T00:00:00')
          .or.query(
            (sub) =>
              sub // Grouping
                .notEquals('Approvable', true)
                .and.notEquals('Description', '*alma*'), // Contains with wildcards
          )
          .sort('DisplayName')
          .top(5) // adds .TOP:5
          .skip(10), // adds .SKIP:10
    )
    
    console.log(query.toString())
    // "TypeIs:Task AND DisplayName:'Unicorn' AND ModificationDate:{'2017-01-01T00\\:00\\:00' TO '2017-02-01T00\\:00\\:00'} OR (NOT(Approvable:'true') AND NOT(Description:'*alma*')) .SORT:DisplayName .TOP:5 .SKIP:10"

    Install

    npm i @sensenet/query

    Homepage

    sensenet.com

    DownloadsWeekly Downloads

    59

    Version

    2.1.2

    License

    GPL-2.0

    Unpacked Size

    205 kB

    Total Files

    43

    Last publish

    Collaborators

    • kubehu
    • blaskodaniel
    • herflis
    • tusmester
    • kavics
    • vargajoe
    • pusztaie
    • taki9