Add link to documentation
Phrasing
Add support link to README
GNU database management wrapper for Crystal.
Should work identically to the ruby version. Big thanks to the go version for implementation insights.
Detailed API documentation can be found here.
shard.yml
:dependencies:
gdbm:
git: https://git.sr.ht/~fancycade/crystal-gdbm
branch: master
shards install
require "gdbm"
# Will make a new database by default (overwrite previous)
# db = GDBM.new("foobar.db")
# Set WR flag to open existing db or make new
db = GDBM.new("foobar.db", flags: GDBM::WR)
db.store "foo", "bar"
puts db.fetch "foo"
db.close
You can think of GDBM as a persistent hash map.
require "gdbm"
db = GDBM.new("foobar.db")
db["foo"] = "bar"
puts db["foo"] #=> "bar"
puts db["foo"]? #=> true
db["bar"] = "foo"
db.each do |k, v|
puts k
puts v
end
db.each_key do |k|
puts k
end
db.each_value do |v|
puts v
end
db.close
If you have questions or have an issue submit a ticket here.
Fancy Cade hereby disclaims all copyright interest in crystal-gdbm written by fancycade.
fancycade 2019
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.