Project

pg-hstore

0.06
No commit activity in last 3 years
No release in over 3 years
postgresql hstore parser/deparser - provides PgHstore.dump and PgHstore.load (aka parse)
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
>= 0
 Project Readme

pg-hstore

The gem is called pg-hstore, but you should require pg_hstore (sorry):

>> require 'pg_hstore'
=> true

Dump a hash to an hstore string:

>> hstore = PgHstore.dump(hello: %{world, you're "GREAT!"})
=> "'\"hello\" => \"world, you''re \\\"GREAT!\\\"\"'"

Load an hstore string into a hash:

>> hash = PgHstore.load(hstore)
=> {:hello=>"world, you're \"GREAT!\""}

Dump a hash for use as a bind parameter/variable (i.e., we won't be needing single quotes):

>> hstore = PgHstore.dump({hello: %{world, you're "GREAT!"}}, true)
=> "\"hello\" => \"world, you're \\\"GREAT!\\\"\""

Load an hstore string but don't symbolize keys:

>> hash = PgHstore.load(hstore, false)
=> {"hello"=>"world, you're \"GREAT!\""}

Authors

Copyright

Copyright (c) 2013 the authors. See LICENSE for details.