:nocov:
Methods
Public Class
Public Instance
Included modules
- Sequel::SQL::AliasMethods
Classes and Modules
Constants
DEFAULT_PROC | = | lambda{|h, k| h[k.to_s] unless k.is_a?(String)} |
Default proc used for all underlying |
Public Class methods
Use custom marshal loading, since underlying hash uses a default proc.
# File lib/sequel/extensions/pg_hstore.rb 203 def self._load(args) 204 new(Hash[Marshal.load(args)]) 205 end
Parse the given string into an HStore
, assuming the str is in PostgreSQL hstore output format.
# File lib/sequel/extensions/pg_hstore.rb 209 def self.parse(str) 210 new(Parser.new(str).parse) 211 end
Public Instance methods
Use custom marshal dumping, since underlying hash uses a default proc.
# File lib/sequel/extensions/pg_hstore.rb 235 def _dump(*) 236 Marshal.dump(to_a) 237 end
Override to force the key argument to a string.
# File lib/sequel/extensions/pg_hstore.rb 240 def fetch(key, *args, &block) 241 super(key.to_s, *args, &block) 242 end
Convert the input hash to string keys and values before merging, and return a new HStore
instance with the merged hash.
# File lib/sequel/extensions/pg_hstore.rb 246 def merge(hash, &block) 247 self.class.new(super(convert_hash(hash), &block)) 248 end
Wrap the receiver in an HStoreOp
so you can easily use the PostgreSQL hstore functions and operators with it.
# File lib/sequel/extensions/pg_hstore_ops.rb 371 def op 372 HStoreOp.new(self) 373 end
Allow automatic parameterization.
# File lib/sequel/extensions/pg_hstore.rb 284 def sequel_auto_param_type(ds) 285 "::hstore" 286 end
Append a literalize version of the hstore to the sql.
# File lib/sequel/extensions/pg_hstore.rb 254 def sql_literal_append(ds, sql) 255 ds.literal_append(sql, unquoted_literal) 256 sql << '::hstore' 257 end
Return a string containing the unquoted, unstring-escaped literal version of the hstore. Separated out for use by the bound argument code.
# File lib/sequel/extensions/pg_hstore.rb 262 def unquoted_literal 263 str = String.new 264 comma = false 265 commas = "," 266 quote = '"' 267 kv_sep = "=>" 268 null = "NULL" 269 each do |k, v| 270 str << commas if comma 271 str << quote << escape_value(k) << quote 272 str << kv_sep 273 if v.nil? 274 str << null 275 else 276 str << quote << escape_value(v) << quote 277 end 278 comma = true 279 end 280 str 281 end