Repository is archived
No release in over a year
SQL.JS adapter for Sequel on browser with Bormaŝino / ruby.wasm
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 0.1.9
 Project Readme

bormashino-sequel-sqljs-adapter

rspec

SQL.JS adapter for Sequel on browser with Bormaŝino / ruby.wasm

Demo

https://bormashino-sequel-sqljs-adapter.vercel.app/

Quickstart

on typical bormashino-app-template project

$ npm i bormashino-sequel-sqljs-adapter
$ (cd src && bundle add bormashino-sequel-sqljs-adapter)

app.js

import initSqlJs from 'sql.js'
import sqlWasm from 'url:../node_modules/sql.js/dist/sql-wasm.wasm'
import { dbWrapper } from 'bormashino-sequel-sqljs-adapter'
const SQL = await initSqlJs({ locateFile: () => sqlWasm })
const db = new SQL.Database()
window.database = dbWrapper(db)

app.rb

require 'sequel'
require 'bormashino_sequel_sqljs_adapter'
# sqljs://<name of dbWrapper instance under window object>
@db = Sequel.connect('sqljs://database')

@db.create_table :items do
  primary_key :id
  String :name
  Float :price
end

items = @db[:items]

Release

rubygem

$ cd gem
$ bundle exec rake build
$ gem push pkg/bormashino-sequel-sqljs-adapter-XXX.gem

npm package

$ cd npm
$ npm publish

License

MIT