Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/armanbilge/porcupine

Skunk-inspired library for SQLite on JVM, Node.js, and Native
https://github.com/armanbilge/porcupine

cats-effect scala scala-native scalajs sqlite

Last synced: 2 months ago
JSON representation

Skunk-inspired library for SQLite on JVM, Node.js, and Native

Awesome Lists containing this project

README

        

# porcupine

[Skunk]-inspired library for [SQLite] on JVM, Node.js, and Native!

```scala
libraryDependencies += "com.armanbilge" %%% "porcupine" % ""
```

[Skunk]: https://github.com/tpolecat/skunk
[SQLite]: https://www.sqlite.org

## Installation

### JVM

Delegates to the [JDBC Driver].

[JDBC Driver]: https://github.com/xerial/sqlite-jdbc

### Node.js

Requires the [better-sqlite3] npm package.

```
npm i better-sqlite3
```

[better-sqlite3]: https://www.npmjs.com/package/better-sqlite3

### Native

You must provide a native build of SQLite3. Here are three interesting ways to do this.

1. Dynamically linking to an existing installation of sqlite3.
```scala
nativeConfig ~= { c => c.withLinkingOptions(c.linkingOptions :+ "-lsqlite3") }
```

2. Statically linking a pre-compiled SQLite into your binary. [sn-vcpkg] is a great way to do this. An ad-hoc configuration might look like this:
```scala
nativeConfig ~= { c => c.withLinkingOptions(c.linkingOptions :+ "/usr/local/Cellar/sqlite/3.41.0/lib/libsqlite3.a") }
```

3. Compiling SQLite as part of your project. You can download the SQLite [amalgation] as a single `sqlite3.c` file and place it in your `resources/scala-native` directory.

[sn-vcpkg]: https://github.com/indoorvivants/sn-vcpkg
[amalgation]: https://www.sqlite.org/amalgamation.html