sanakirju-knex

0.9.1 • Public • Published

Sanakirju Knex.js

Knex.js / SQL implementation of Sanakirju, a Karelian - Finnish dictionary with over 90 000 words. Based on data from Karjalan Kielen Sanakirja. Example implementation for all Knex supported SQL databases, like PostgreSQL, MySQL, MariaDB or SQLite.

Install

yarn add sanakirju-knex

You also need to install the database driver you're going to use.

npm install pg
npm install sqlite3
npm install mysql
npm install mysql2

Usage

The library provides a way to create & populate a database based on your Knex config.

const { createDB } = require('sanakirju-knex')

/**
 * Your Knex config file. 
 * NOTE: Leave "migrations" empty.
 */
const knexConf = {...}

const res = await createDB(knexConf)
console.log(res)

To query the database, just use Knex as you always would.

const Knex = require('knex')

const knexConf = {...}
const knex = Knex(knexConf)

const aWords = await knex('words')
    .where({ startsWith: 'a' })

Sources.

Words & translations are from Karjalan Kielen Sanakirja created by Institute for the Languages of Finland. The original material is licenced under Creative Commons International (CC BY 4.0).

Readme

Keywords

none

Package Sidebar

Install

npm i sanakirju-knex

Weekly Downloads

0

Version

0.9.1

License

MIT

Unpacked Size

7.46 kB

Total Files

16

Last publish

Collaborators

  • stscoundrel