module JsonbAccessor::QueryBuilder

def self.convert_keys_to_store_keys(attributes, store_key_mapping)

def self.convert_keys_to_store_keys(attributes, store_key_mapping)
  attributes.each_with_object({}) do |(name, value), new_attributes|
    store_key = store_key_mapping[name.to_s]
    new_attributes[store_key] = value
  end
end

def self.validate_column_name!(query, column_name)

def self.validate_column_name!(query, column_name)
  if query.model.columns.none? { |column| column.name == column_name.to_s }
    raise InvalidColumnName, "a column named `#{column_name}` does not exist on the `#{query.model.table_name}` table"
  end
end