crystal-mimer
Version, currently 0.1.12 versions
- 0.1.1latestJul 3, 2026
- 0.1.0not indexedJul 3, 2026
github.com/majorproblem/crystal-mimer
Mimer SQL database driver for Crystal
1 stars
0 dependents
License: MIT
Installation
# Add this to your shard.yml
dependencies:
crystal-mimer:
github: majorproblem/crystal-mimer
version: ~> 0.1.1Then run:
shards installshard.yml
- Crystal
>= 1.0.0- License
- MIT
- Author
- Karl-König Königsson
Dependencies
Runtime Dependencies
- db~> 0.13.1github: crystal-lang/crystal-db
README
crystal-mimer
Mimer SQL database driver for Crystal, built on the crystal-db interface.
Prerequisites
- Mimer SQL installed with
libmimerapiavailable on your library path - Crystal >= 1.0.0
Installation
Add to your shard.yml:
dependencies:
mimer:
github: majorproblem/crystal-mimer
version: ~> 0.1.0
Then run:
shards install
Usage
require "mimer"
DB.open("mimer://USER:PASSWORD@/DATABASE") do |db|
# DDL
db.exec "CREATE TABLE users (id INTEGER, name NVARCHAR(100), active BOOLEAN)"
# Parameterized insert
db.exec "INSERT INTO users VALUES (?, ?, ?)", 1, "Alice", true
# Query
db.query "SELECT id, name, active FROM users" do |rs|
rs.each do
id = rs.read(Int32)
name = rs.read(String)
active = rs.read(Bool)
puts "#{id}: #{name} (active=#{active})"
end
end
# Scalar query
count = db.query_one "SELECT COUNT(*) FROM users", as: Int32
# Nullable column
name = db.query_one "SELECT name FROM users WHERE id = ?", 99, as: String?
end
Connection URI
mimer://USER:PASSWORD@/DATABASE # local database
mimer://USER:PASSWORD@SERVER/DATABASE # network connection via server alias
Transactions
Transactions use the Mimer C API (MimerBeginTransaction / MimerEndTransaction) rather than SQL statements:
DB.open("mimer://USER:PASSWORD@/DATABASE") do |db|
db.transaction do |tx|
tx.connection.exec "INSERT INTO users VALUES (?, ?, ?)", 2, "Bob", false
# raises → automatic rollback
end
end
Supported types
| Crystal type | Mimer SQL type |
|---|---|
Int32 | INTEGER |
Int64 | BIGINT |
Float64 | DOUBLE PRECISION, FLOAT |
String | NVARCHAR, VARCHAR, CHAR |
Bool | BOOLEAN |
Nil / nilable | NULL |
Running the tests
Tests require a live Mimer SQL instance and a writable databank:
MIMER_DATABASE=testdb MIMER_USER=SYSADM MIMER_PASSWORD=SYSADM crystal spec
License
MIT — see LICENSE.
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.1.1- Tagged
- Jul 3, 2026
- Commit
977f6dd20f76- Crystal
>= 1.0.0- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/majorproblem/crystal-mimer
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 14, 2026
- Synced
- Aug 14, 2026
- Versions
- 2