This is a JS client for the LunaQL NoSQL database.
import { Database } from './src'
const db = new Database({
endpoint: '<endpoint>',
token: '<token>'
});
type User = {
_id: number;
_fk: string;
first_name: string;
last_name: string;
email_address: string;
tasks: Task[];
created_at: string;
updated_at: string;
}
type Task = {
_id: number;
_fk: string;
user_id: number;
title: string;
created_at: string;
updated_at: string;
}
const main = async () => {
const objectIDs = await db.query()
.from('users')
.limit(1)
.select(['_fk'])
.list('_fk');
const results = await db.query()
.from('users')
.where('_fk', 'in', objectIDs)
.hasMany('tasks', (q) => {
q.where('user_id', '=', '$._id').orderBy('created_at', 'asc');
})
.fetch<User[]>();
console.log(results)
}
main();
- Add tests
- Implement error handling
- Implement more query methods
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.