0.0.293 • Published 11 months ago

@malloydata/malloy-filter v0.0.293

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

Filter Languages

There is a unique filter language for each filterable data type. The documentation-bRoKeN-lInK describes the various languages.

Grammars

malloy-filter use moo and nearley to generate parsers for each sub language. The grammars are in grammars.

After changing a .ne file use npm run build to update the generated parser.

API

Refer to the clause interfaces for details on the output of the parser, or look at the parser tests in src/test/ for more examples of parser output.

import {StringFilterExpression, StringClause} from '@malloydata/malloy-filter'

// or ...
// NumberFilterExpression, NumberClause
// BooleanFilterExpression, BooleanClause
// TemporalFilterExpression, TemporalClause

// Each has two entry points, "parse" and "unparse"

const stringParse = StringFilterExpression.parse('FOO%,-FOOD')
if (stringParse.parsed) {
    console.log(JSON.stringify(stringParse.parsed, null, 2));
    /*
     * Output will look something like this ...
     * { operator: ',',
     *   members: [
     *     {operator: 'starts', values: ['FOO']}
     *     {operator: '=', not: true, values: ['FOOD']}
     *   ],
     * }
     */
    console.log(StringFilterExpression.unparse(stringParse.parse));
    /*
     * There will be minor variations on unparse, for example in this
     * case there will be space after the comma:
     *
     * FOO%, -FOOD
     */
} else {
    console.log(stringParse.log);
}

Testing

The malloy-filter tests use Jest.

npm run build
npm run test
0.0.293

11 months ago

0.0.292

11 months ago

0.0.291

11 months ago

0.0.290

11 months ago

0.0.289

11 months ago

0.0.288

11 months ago

0.0.287

11 months ago

0.0.286

11 months ago

0.0.285

11 months ago

0.0.284

11 months ago

0.0.283

11 months ago

0.0.282

11 months ago

0.0.281

11 months ago

0.0.280

11 months ago

0.0.279

11 months ago

0.0.278

11 months ago

0.0.277

11 months ago

0.0.276

12 months ago

0.0.275

12 months ago

0.0.274

12 months ago

0.0.273

12 months ago

0.0.272

12 months ago

0.0.271

12 months ago

0.0.270

12 months ago

0.0.269

1 year ago

0.0.268

1 year ago

0.0.267

1 year ago

0.0.266

1 year ago

0.0.265

1 year ago

0.0.264

1 year ago

0.0.263

1 year ago

0.0.262

1 year ago

0.0.261

1 year ago

0.0.260

1 year ago

0.0.259

1 year ago

0.0.258

1 year ago

0.0.257

1 year ago

0.0.256

1 year ago

0.0.255

1 year ago

0.0.254

1 year ago

0.0.253

1 year ago

0.0.252

1 year ago

0.0.251

1 year ago

0.0.250

1 year ago

0.0.249

1 year ago

0.0.248

1 year ago

0.0.247

1 year ago

0.0.246

1 year ago

0.0.245

1 year ago

0.0.244

1 year ago

0.0.243

1 year ago

0.0.242

1 year ago

0.0.241

1 year ago

0.0.240

1 year ago

0.0.239

1 year ago

0.0.238

1 year ago

0.0.237

1 year ago