GNU database management wrapper for Crystal.
Detailed API documentation can be found here.
dependencies: gdbm: git: https://git.sr.ht/~fancycade/crystal-gdbm branch: master
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.
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/.