Registry / database / expo-sendylo-sqlite-helper

expo-sendylo-sqlite-helper

JSON →
library1.2.0jsnpmunverified

Expo SQLite Query Helper (v1.2.0) is a lightweight, zero-config query builder for expo-sqlite in React Native apps. It provides a simple async API for common SQL operations (createTable, insert, search, update, delete) with automatic promise handling and result objects (row, insertId, lastQuery). Unlike raw SQLite, it abstracts away SQL syntax while still exposing the last executed query for debugging. Compatible with Expo SDK 46+ and expo-sqlite 10.3+. Ships TypeScript types. Alternative to Knex.js or TypeORM for Expo projects. Release cadence: monthly minor updates.

npm install expo-sendylo-sqlite-helper
INSTALL
IMPORT
SIG · EXPO-SENDYLO-SQLIT
E
expo-sendylo-sqlite-helper
databasejavascriptv1.2.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Database (default import)
import Database from 'expo-sqlite-query-helper'
import { Database } from 'expo-sqlite-query-helper'
Database is exported as default, not named. The named export is actually 'default'.
createTable
import { createTable } from 'expo-sqlite-query-helper'
import createTable from 'expo-sqlite-query-helper'
createTable is a named export. Common mistake: treating it as default.
insert
import { insert } from 'expo-sqlite-query-helper'
import insert from 'expo-sqlite-query-helper'
Named export, not default.
search
import { search } from 'expo-sqlite-query-helper'
import search from 'expo-sqlite-query-helper'
Named export.

Initializes database, creates table, inserts multiple rows, and searches by condition.

import React, { useEffect } from 'react'; import Database, { createTable, insert, search } from 'expo-sqlite-query-helper'; const App = () => { useEffect(() => { Database('myApp.db'); createTable('users', { name: 'TEXT NOT NULL', email: 'TEXT UNIQUE' }) .then(({ row, insertId, lastQuery }) => { console.log('Table created', lastQuery); }) .catch((error) => console.error(error)); insert('users', [ { name: 'Alice', email: 'alice@example.com' }, { name: 'Bob', email: 'bob@example.com' } ]) .then(({ rowAffected, insertId }) => { console.log(`Inserted ${rowAffected} rows, last ID: ${insertId}`); }); search('users', { name: 'Alice' }) .then(({ row }) => { console.log('Search result:', row._array); }); }, []); return null; }; export default App;
Debug
Known issues
gotchaDatabase() must be called before any query functions. If called inside a component that re-renders, it may close previous connection.
fix
Call Database only once (e.g., in App component or a singleton).
affects: <2.0
deprecatedThe `row` property in results for SELECT queries returns a custom WewSQLRows object with `_array` field, not a plain array. Access data via `row._array`.
fix
Use `result.row._array` to get array of objects.
affects: >=1.0
gotchaThe default database name is 'esqh.db' if not specified. Ensure you use a consistent name across your app.
fix
Always pass a database name to Database() (e.g., Database('myApp.db')).
affects: >=1.0
breakingIn version 1.0, the `insert()` function expected an object instead of an array for single insert. This was changed to always accept array of objects.
fix
Use array syntax: insert('table', [{...}]) for single or multiple rows.
affects: 1.0
Errors
Common errors & fixes
TypeError: Cannot read properties of null (reading 'insert')
Database() not called before using insert/search functions.
fix
Ensure Database('name.db') is called at app startup.
TypeError: (0 , _module.createTable) is not a function
Using default import instead of named import for createTable.
fix
Use `import { createTable } from 'expo-sqlite-query-helper'`.
Error: No database found. Please initialize with Database() first.
Database() called after a query function has already been invoked.
fix
Restructure code to call Database() before any other import functions.
Upgrade
Version history
1.2.0latest on npm
Audit
Dependencies
exporequiredpeer dependency
expo-sqliterequiredpeer dependency for SQLite operations
reactrequiredpeer dependency for React Native
Agent activity
11 hits · last 30 days
node
10
Resources
expo-sendylo-sqlite-helper — npm install expo-sendylo-sqlite-helper · libregistry