0.3.1 • Published 7 months ago

@criterium/kysely v0.3.1

Weekly downloads
-
License
ISC
Repository
github
Last release
7 months ago

@criterium/kysely

@criterium/kysely allow to add filter, sort and pagination to kysely queries using mongo-like syntax.

install

npm i @criterium/kysely

usage

import customize, { QueryValidationError } from '@criterium/kysely';
import { db } from './db';

const query = customize(db.selectFrom('posts').selectAll(), {
  $and: [
    { created: { $gte: new Date("2025-01-01") } },
    { title: { $like: 'bitcoin %' } },
  ],
  $sort: { created: -1 },
  $limit: 15
});

if (query instanceof QueryValidationError) throw query;
//or if (query instanceof Error) throw query;

const results = await query.execute();
console.log(results);
0.3.0

7 months ago

0.3.1

7 months ago

0.2.0

1 year ago

0.1.0

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago