How to use @shabados/database - 7 common examples

To help you get started, we’ve selected a few @shabados/database examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ShabadOS / desktop / app / lib / Updater.js View on Github external
async updateDatabase() {
    // Download and extract the database package from npm
    logger.info( `Downloading database update to ${this.tempFolder}` )
    await remove( this.tempFolder )
    await extract( databasePackage, this.tempFolder )

    logger.info( 'Hot-patching database module' )
    // Disconnect the Shabad OS database connection
    await knex.destroy()
    // Move across the updated npm database module
    await move( this.tempFolder, DATABASE_FOLDER, { overwrite: true } )
    // Reimport the database
    //! Relies on knex being reinitialised globally
    importFresh( '@shabados/database' )
  }
github ShabadOS / desktop / app / lib / db.js View on Github external
export const fullWordSearch = words => Lines
  .query()
  .limit( MAX_RESULTS )
  .fullWord( words )
github ShabadOS / desktop / app / lib / db.js View on Github external
export const getBaniLines = baniId => Banis
  .query()
  .joinEager( 'lines.shabad' )
  .orderBy( [ 'line_group', 'l.order_id' ] )
  .where( 'banis.id', baniId )
  .withTranslations()
  .withTransliterations()
  .eagerOptions( { minimize: false, aliases: { lines: 'l' } } )
  .then( ( [ bani ] ) => bani )
github ShabadOS / desktop / app / lib / db.js View on Github external
export const getBanis = () => Banis.query()
github ShabadOS / desktop / app / lib / db.js View on Github external
export const getLanguages = () => Languages.query()
github ShabadOS / desktop / app / lib / db.js View on Github external
export const getShabad = shabadId => Shabads
  .query()
  .where( 'shabads.id', shabadId )
  .eager( 'lines' )
  .withTransliterations()
  .withTranslations()
  .then( ( [ shabad ] ) => shabad )
github ShabadOS / desktop / app / lib / db.js View on Github external
export const getSources = () => Sources
  .query()
  .eager( 'translationSources' )
  .then( sources => sources.reduce( (
    ( acc, { translationSources, id, ...source } ) => ( {
      ...acc,
      [ id ]: {
        ...source,
        translationSources: groupBy(
          translationSources,
          ( { languageId } ) => languageId,
        ),
      },
    } ) ), {} ) )
  .then( sources => ( {
    sources,
    recommended: Object.entries( sources ).reduce( (

@shabados/database

The open gurbani database containing an evolving set of corrections. Used in Shabad OS software.

GPL-3.0
Latest version published 2 years ago

Package Health Score

59 / 100
Full package analysis