turso 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +74 -0
- data/ext/turso_ruby/Cargo.lock +2990 -0
- data/ext/turso_ruby/Cargo.toml +7 -3
- data/ext/turso_ruby/extconf.rb +2 -4
- data/lib/turso/database.rb +109 -0
- data/lib/turso/result_set.rb +15 -19
- data/lib/turso/row.rb +23 -13
- data/lib/turso/statement.rb +146 -0
- data/lib/turso/transaction.rb +8 -2
- data/lib/turso/turso_ruby.so +0 -0
- data/lib/turso/version.rb +5 -0
- data/lib/turso.rb +8 -2
- metadata +22 -3
- data/lib/turso/db.rb +0 -52
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d819cbe53dc4a69a552a98c9bc7f896aec2059c52e6ac2b9342381b5e499f50e
|
|
4
|
+
data.tar.gz: b3db7c4e0e15bd29cabfd6ae4c2fd2c1258e8551867fa5da667af8c3b6688681
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: baa15d2603ba1058c4070d8093703cad17efd16d525efe81481def07c4764745c5407c6bd65e0c6c43cd93da8581401cd4f41fd1b93193a9574de2389e76b922
|
|
7
|
+
data.tar.gz: 15735070276b8ad1a36a6557d007c4d19bd8d1a61ac9a47efd7e201f661bd61371030a931e2d3ecd3bc7c7a76f1a66608dc6331e5c13ee1ce6de0212db8369ab
|
data/README.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Turso Ruby Gem
|
|
2
|
+
|
|
3
|
+
Ruby bindings for [Turso](https://turso.tech), the SQLite-compatible database built for production workloads.
|
|
4
|
+
|
|
5
|
+
**Requires Ruby >= 3.2.0**
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
gem install turso
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Platform-specific native gems are available for Linux, macOS, and Windows.
|
|
14
|
+
|
|
15
|
+
## Quick Start
|
|
16
|
+
|
|
17
|
+
```ruby
|
|
18
|
+
require "turso"
|
|
19
|
+
|
|
20
|
+
db = Turso::Database.new(":memory:")
|
|
21
|
+
db.execute("CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT)")
|
|
22
|
+
db.execute("INSERT INTO users (name) VALUES (?)", "Alice")
|
|
23
|
+
row = db.get_first_row("SELECT * FROM users WHERE id = ?", 1)
|
|
24
|
+
p row
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Open Options
|
|
28
|
+
|
|
29
|
+
| Option | Type | Description |
|
|
30
|
+
|--------|------|-------------|
|
|
31
|
+
| `readonly` | Boolean | Open database in read-only mode |
|
|
32
|
+
| `file_must_exist` | Boolean | Fail if database file does not exist |
|
|
33
|
+
| `busy_timeout` | Integer | Busy timeout in milliseconds |
|
|
34
|
+
| `query_timeout` | Integer | Query timeout in milliseconds |
|
|
35
|
+
| `experimental_features` | String | Comma-separated experimental features |
|
|
36
|
+
| `encryption` | Hash | Encryption config: `{ cipher: "aes256", hexkey: "..." }` |
|
|
37
|
+
| `vfs` | Symbol/String | VFS backend: `:memory`, `:syscall`, `:io_uring` |
|
|
38
|
+
|
|
39
|
+
```ruby
|
|
40
|
+
db = Turso::Database.new("my.db", readonly: true, busy_timeout: 5000)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Named Parameters
|
|
44
|
+
|
|
45
|
+
```ruby
|
|
46
|
+
db.execute("INSERT INTO users (name) VALUES (:name)", name: "Alice")
|
|
47
|
+
row = db.get_first_row("SELECT * FROM users WHERE x = :name", name: "Alice")
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Exception Hierarchy
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
Turso::Exception (base)
|
|
54
|
+
├── Turso::BusyException
|
|
55
|
+
├── Turso::ConstraintException
|
|
56
|
+
├── Turso::CorruptException
|
|
57
|
+
├── Turso::MisuseException
|
|
58
|
+
├── Turso::ReadonlyException
|
|
59
|
+
├── Turso::InterruptException
|
|
60
|
+
├── Turso::DatabaseFullException
|
|
61
|
+
├── Turso::NotADatabaseException
|
|
62
|
+
├── Turso::BusySnapshotException
|
|
63
|
+
└── Turso::IoException
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
`Turso::Error` is an alias for `Turso::Exception`.
|
|
67
|
+
|
|
68
|
+
## License
|
|
69
|
+
|
|
70
|
+
MIT License. See [LICENSE](LICENSE).
|
|
71
|
+
|
|
72
|
+
## Contributing
|
|
73
|
+
|
|
74
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/tursodatabase/turso.
|