edadma / petradb   1.1.1

ISC License GitHub
Scala versions: 3.x
Scala.js versions: 1.x
Scala Native versions: 0.5

PetraDB

Maven Central npm License

A lightweight, embeddable SQL database engine for JavaScript, TypeScript, and Scala. Compiles to JVM, Node.js, and Native. No external dependencies, no server required.

Quick Start

JavaScript / TypeScript

npm install @petradb/engine
import { Session } from '@petradb/engine';

const db = new Session();

await db.execute(`
  CREATE TABLE users (id SERIAL, name TEXT NOT NULL, email TEXT);
  INSERT INTO users (name, email) VALUES ('Alice', '[email protected]');
`);

const [{ rows }] = await db.execute('SELECT * FROM users');
console.log(rows); // [{ id: 1, name: 'Alice', email: 'alice@example.com' }]

Scala

libraryDependencies += "io.github.edadma" %%% "petradb-engine" % "1.1.1"
import io.github.edadma.petradb.*

given Session = new MemoryDB().connect()

executeSQL("""
  CREATE TABLE users (id SERIAL, name TEXT NOT NULL, email TEXT);
  INSERT INTO users (name, email) VALUES ('Alice', '[email protected]');
  SELECT * FROM users;
""").foreach(println)

Documentation

Full documentation, SQL reference, and guides are available at petradb.dev.

License

ISC