sqlite3_uri.cr
sqlite3_uri
Automatically convert URI
instances to a String
when writing to a sqlite3 database, and expect a String
to convert back to a URI
instance when reading from a ResultSet
.
Installation
-
Add the dependency to your
shard.yml
:dependencies: sqlite3_uri: github: plambert/sqlite3_uri.cr
-
Run
shards install
Both db
and sqlite3
will be brought in as dependencies by this shard; you don't need to specify them separately in your shard.yml
.
Usage
require "sqlite3_uri"
DB.open "sqlite3:%3Amemory%3A" do |db|
db.exec "CREATE TABLE urls (id INTEGER PRIMARY KEY, url TEXT NOT NULL)"
ARGV.each do |url|
db.exec "INSERT INTO urls (url) VALUES (?)", URI.parse url
end
urls = db.query_all "SELECT url FROM urls", as: URI
puts urls.inspect
end
Contributing
- Fork it (https://github.com/plambert/sqlite3_uri.cr/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- Paul M. Lambert - creator and maintainer
Repository
sqlite3_uri.cr
Owner
Statistic
- 0
- 0
- 0
- 1
- 1
- about 20 hours ago
- July 8, 2025
License
MIT License
Links
Synced at
Tue, 08 Jul 2025 21:52:38 GMT
Languages