Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sql-light

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sql-light

SQLite query builder for ya smol project

  • 1.0.0
  • npm
  • Socket score

Version published
Weekly downloads
8
increased by700%
Maintainers
1
Weekly downloads
 
Created
Source

sql-light

A simple SQLite query builder.

Example using Bun SQLite:

import sql from 'sql-light';
import db from './my-db.db' with { type: 'sqlite' };

// Create user table
const userTable = sql.table({
    name: 'Users',
    schema: {
        name: 'text not null',
        pass: 'text not null'
    },
    // Type hint here
    primaryKeys: ['name']
});

// Run create table statement
db.run(userTable.init);

// Create a query
const selectUser = sql.query<{
    name: string
}>($ => `select ${userTable.col('pass')} from ${userTable} where ${userTable.$name} = ${$.name}`);

// Feed to Bun query initializer
const query = db.query<{ pass: string }, typeof selectUser.infer>(selectUser);

FAQs

Package last updated on 29 Jan 2024

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc