Module: Rasti::DB

Extended by:
ClassConfig, MultiRequire
Defined in:
lib/rasti/db.rb,
lib/rasti/db/model.rb,
lib/rasti/db/query.rb,
lib/rasti/db/version.rb,
lib/rasti/db/collection.rb,
lib/rasti/db/nql/syntax.rb,
lib/rasti/db/data_source.rb,
lib/rasti/db/environment.rb,
lib/rasti/db/relations/base.rb,
lib/rasti/db/relations/graph.rb,
lib/rasti/db/computed_attribute.rb,
lib/rasti/db/nql/nodes/sentence.rb,
lib/rasti/db/nql/nodes/attribute.rb,
lib/rasti/db/relations/one_to_one.rb,
lib/rasti/db/nql/nodes/binary_node.rb,
lib/rasti/db/nql/nodes/conjunction.rb,
lib/rasti/db/nql/nodes/disjunction.rb,
lib/rasti/db/relations/many_to_one.rb,
lib/rasti/db/relations/one_to_many.rb,
lib/rasti/db/relations/many_to_many.rb,
lib/rasti/db/type_converters/sqlite.rb,
lib/rasti/db/nql/nodes/array_content.rb,
lib/rasti/db/nql/nodes/constants/base.rb,
lib/rasti/db/nql/nodes/constants/time.rb,
lib/rasti/db/nql/nodes/constants/true.rb,
lib/rasti/db/type_converters/postgres.rb,
lib/rasti/db/nql/nodes/constants/array.rb,
lib/rasti/db/nql/nodes/constants/false.rb,
lib/rasti/db/nql/nodes/constants/float.rb,
lib/rasti/db/nql/nodes/comparisons/base.rb,
lib/rasti/db/nql/nodes/comparisons/like.rb,
lib/rasti/db/nql/nodes/constants/string.rb,
lib/rasti/db/nql/nodes/comparisons/equal.rb,
lib/rasti/db/nql/nodes/constants/integer.rb,
lib/rasti/db/nql/invalid_expression_error.rb,
lib/rasti/db/type_converters/time_in_zone.rb,
lib/rasti/db/nql/nodes/comparisons/include.rb,
lib/rasti/db/nql/nodes/parenthesis_sentence.rb,
lib/rasti/db/nql/nodes/comparisons/less_than.rb,
lib/rasti/db/nql/nodes/comparisons/not_equal.rb,
lib/rasti/db/nql/nodes/comparisons/not_include.rb,
lib/rasti/db/nql/nodes/comparisons/greater_than.rb,
lib/rasti/db/nql/nodes/constants/literal_string.rb,
lib/rasti/db/type_converters/sqlite_types/array.rb,
lib/rasti/db/type_converters/postgres_types/json.rb,
lib/rasti/db/nql/filter_condition_strategies/base.rb,
lib/rasti/db/type_converters/postgres_types/array.rb,
lib/rasti/db/type_converters/postgres_types/jsonb.rb,
lib/rasti/db/type_converters/postgres_types/hstore.rb,
lib/rasti/db/nql/filter_condition_strategies/sqlite.rb,
lib/rasti/db/nql/filter_condition_strategies/postgres.rb,
lib/rasti/db/nql/nodes/comparisons/less_than_or_equal.rb,
lib/rasti/db/nql/nodes/comparisons/greater_than_or_equal.rb,
lib/rasti/db/nql/filter_condition_strategies/types/generic.rb,
lib/rasti/db/nql/filter_condition_strategies/types/pg_array.rb,
lib/rasti/db/nql/filter_condition_strategies/types/sqlite_array.rb,
lib/rasti/db/nql/filter_condition_strategies/unsupported_type_comparison.rb

Defined Under Namespace

Modules: NQL, Relations, TypeConverters Classes: Collection, ComputedAttribute, DataSource, Environment, Model, Query

Constant Summary collapse

VERSION =
'4.2.0'

Class Method Summary collapse

Class Method Details

.from_db(value) ⇒ Object



36
37
38
39
40
# File 'lib/rasti/db.rb', line 36

def self.from_db(value)
  type_converters.inject(value) do |result, type_converter|
    type_converter.from_db result
  end
end

.nql_filter_condition_for(comparison_name, identifier, argument) ⇒ Object



42
43
44
45
# File 'lib/rasti/db.rb', line 42

def self.nql_filter_condition_for(comparison_name, identifier, argument)
  raise 'Undefined Rasti::DB.nql_filter_condition_strategy' unless nql_filter_condition_strategy
  nql_filter_condition_strategy.filter_condition_for comparison_name, identifier, argument
end

.to_db(db, collection_name, attribute_name, value) ⇒ Object



30
31
32
33
34
# File 'lib/rasti/db.rb', line 30

def self.to_db(db, collection_name, attribute_name, value)
  type_converters.inject(value) do |result, type_converter|
    type_converter.to_db db, collection_name, attribute_name, result
  end
end