npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

loopback-connector-sqlite3

v3.0.0

Published

Loopback SQLite3 Connector

Downloads

848

Readme

loopback-connector-sqlite3

SQLite is a self-contained, high-reliability, embedded, full-featured, public-domain, SQL database engine. This is the official SQLite3 connector module for the LoopBack framework.

Installation

Enter the following in the top-level directory of your LoopBack application:

$ npm install loopback-connector-sqlite3 --save

The --save option adds the dependency to the application's package.json file.

Connector settings

Configure the connector with the following data source properties:

  • file: The path to the database file or :memory:
  • debug: Display debug information. Default is false.

The SQLite3 connector uses node-sqlite3 as the driver.

Model definition for SQLite3

The model definition consists of the following properties:

  • name: Name of the model, by default, it's the camel case of the table
  • properties: Property definitions, including default value mapping

    {"name": "Inventory", "options": {
      "idInjection": false,
    }, "properties": {
      "id": {
        "type": "String",
        "required": false,
        "length": 64,
        "precision": null,
        "scale": null
      },
      "productId": {
        "type": "String",
        "required": false,
        "length": 20,
        "precision": null,
        "scale": null,
        "id": 1
      },
      "locationId": {
        "type": "String",
        "required": false,
        "length": 20,
        "precision": null,
        "scale": null,
        "id": 1
      },
      "available": {
        "type": "Number",
        "required": false,
        "length": null,
        "precision": 32,
        "scale": 0
      },
      "total": {
        "type": "Number",
        "required": false,
        "length": null,
        "precision": 32,
        "scale": 0
      },
      "createdOn": {
       "type": "Date",
        "required": false,
        "sqlite3": {
          "dbDefault": "now"
        }
      }
    }}

Type Mapping

| LoopBack type | Mapped to SQLite3 type | |-----|-----| | Number| Primary key stored as INTEGER, others as REAL | | Boolean | INTEGER 1 or 0 | | Date | INTEGER (ms since Jan 01 1970 00:00:00 0000) | | String | ? | | Complex types: GeoPoint, Point, List, Array, Object, and sub-models | TEXT in JSON format | | JSON | TEXT |

SQLite3 does not enforce types. Any data can be stored in any column regardless of definiton. This connector attempts to check for invalid Date, Number and JSON types.

Unsupported features

Discovering Models

The SQLite3 connector does not currently support model discovery.

Auto Migrate / Auto Update

The SQLite3 connector does not currently support auto-migrate or auto-upgrade.

Running tests

The tests in this repository are mainly integration tests, meaning you will need to run them using our preconfigured test server.

  1. Ask a core developer for instructions on how to set up test server credentials on your machine
  2. npm test