Socket
Book a DemoInstallSign in
Socket

sqlite-repository

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sqlite-repository

Here are the features for this node module. * Create * Read * Update * Delete * Create Tables * Drop Tables

latest
npmnpm
Version
0.0.21
Version published
Maintainers
1
Created
Source

Introduction

Here are the features for this node module.

  • Create
  • Read
  • Update
  • Delete
  • Create Tables
  • Drop Tables

Schema

Everything with sqlite repository relies on a schema declaration. Here is the specification.

Simple Schema

const personTable = {
    name: "person",
    version: "1.0.0",
    label: "People",
    description: "A place to store people.",
    columns: [
        {
            type: "INTEGER",
            name: "id",
            label: "Identity"
        },
        {
            type: "TEXT",
            name: "firstName",
            label: "First Name"
        },
        {
            type: "TEXT",
            name: "lastName",
            label: "Last Name"
        }
    ],
    primaryKeys: ["id"]
};

Foreign Keys

const = {
    name: "address",
    label: "Address",
    description: "Address Table",
    version: "1.0.0",
    columns: [
        {
            type: "INTEGER",
            name: "id",
            label:"Identifier"
        },
        {
            type: "TEXT",
            name: "address",
            label: "Address"
        },
        {
            type: "TEXT",
            name: "city",
            label: "City"
        },
        {
            type: "INTEGER",
            name: "state",
            label: "State"
        },
        {
            type: "INTEGER",
            name: "zipCode",
            label: "Zip Code"
        },
        {
            type: "INTEGER",
            name: "personId",
            label: "Person Id",
            isRequired: true
        }
    ],
    primaryKeys:["id"],
    foreignKeys: {
            personId: {
                label: "Person",
                source: {
                    name: "person",
                    version: "1.0.0",
                    label: "Addresses",
                    column: "id"
                }
            }
    }
};

Create

    import { Database } from "sqlite-repository";
    
    

FAQs

Package last updated on 17 Jul 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts