@duck-decoy/collections-knex
v0.2.0
Published
Knex-backed RecordCollection for Duck Decoy
Downloads
60
Readme
Knex Collections for Duck Decoy
Provides a Knex-backed RecordCollection implementation for Duck Decoy (GitHub) (npmjs.com).
Usage
import knex from 'knex'
import { KnexCollection } from '@duck-decoy/collections-knex'
type CarId = number
interface Car {
id: CarId
type: string
}
const db = knex({
// Connection details
})
const cars = new KnexCollection<Car, CarId>({
knex: db,
table: 'cars',
records: [{
id: 1,
type: 'Fast',
}, {
id: 2,
type: 'Really Fast',
}, {
id: 3,
type: 'Not Fast At All'
}]
})