0.54.0 • Published 15 days ago

@zerva/sqlite v0.54.0

Weekly downloads
-
License
MIT
Repository
-
Last release
15 days ago

🌱 Zerva useSqliteDatabase

This is a side project of Zerva

SQLite abstraction

Installation

npm install @zerva/sqlite

Help

Use better-sqlite3 through a simplified abstraction layer.

A principle followed here to keep life easy with databases is: Never delete something, in particular no columns!

import { useSqliteDatabase } from '@zerva/sqlite'

// Open / create the database
const db = useSqliteDatabase('test.sqlite')

// Get typed results
interface Person {
  id: number
  name: string
  age: number
}

// Create table only if not exists
// Colums that did not exist before are added
// Colums that are not defined but did exist remain untouched
const table = db.table<Person>('person', {
  name: 'text',
  age: 'integer',
})

// Create index, if not existed before
table.index('name')

// Insert
table.insert({
  name: 'Doe',
  age: 49,
})

// Get all rows
const allRows = table.all()

// Get one row
const doe = table.get(1)

// Directly do all you like do with BetterSQLite3
const betterSQLiteDatabase = db.db

Links

Inspirations and alternatives:

0.54.0

15 days ago

0.53.1

30 days ago

0.51.0

1 month ago

0.51.1

1 month ago

0.52.0

1 month ago

0.50.0

1 month ago

0.49.0

1 month ago

0.48.0

1 month ago

0.47.0

1 month ago

0.46.0

1 month ago

0.45.0

1 month ago

0.44.0

1 month ago

0.42.2

2 months ago

0.41.1

3 months ago

0.40.2

4 months ago

0.40.1

4 months ago

0.39.0

5 months ago

0.38.0

6 months ago

0.37.0

6 months ago

0.36.0

6 months ago

0.33.3

8 months ago

0.35.0

6 months ago

0.33.2

8 months ago

0.34.0

7 months ago

0.32.0

10 months ago

0.31.0

11 months ago

0.26.1

12 months ago

0.26.0

12 months ago

0.25.0

12 months ago

0.24.1

12 months ago

0.24.0

12 months ago

0.23.0

1 year ago

0.22.2

1 year ago

0.21.0

1 year ago

0.20.1

1 year ago

0.20.0

1 year ago

0.19.0

1 year ago

0.22.1

1 year ago

0.18.0

1 year ago

0.17.2

1 year ago

0.17.0

1 year ago

0.16.8

1 year ago

0.16.7

1 year ago

0.16.6

1 year ago

0.16.5

1 year ago

0.16.4

1 year ago

0.16.2

1 year ago

0.16.1

1 year ago

0.16.0

1 year ago

0.15.3

1 year ago

0.15.1

1 year ago

0.15.0

1 year ago