Module: ActiveRecord::Refined::AST
- Defined in:
- lib/active_record/refined/ast.rb
Defined Under Namespace
Modules: Arithmetics, BitwiseOperands, JsonSteps, Predications, SetSubquery, Windowing Classes: Aggregate, And, Arithmetic, ArrayPredicate, As, Bitwise, BitwiseNot, Case, Cast, Column, Comparison, DatetimeValueFunction, DistinctFrom, Exists, Extract, Function, GroupingSets, In, JsonContains, JsonHasKey, JsonPath, JsonSet, Like, Match, Node, Not, Or, Ordering, Over, Predicate, Quantified, TruthValue, Value, WindowFunction
Constant Summary collapse
- NAME =
/[[:alpha:]_][[:alnum:]_$]*/- ALIAS_NAME =
/\A#{NAME}\z/- FUNCTION_NAME =
/\A#{NAME}(\.#{NAME})?\z/- TYPE_NAME =
A SQL type as cast writes it: words, at most parenthesized with lengths -- double precision, decimal(10,2).
/\A[[:alpha:]_][[:alnum:]_ ]*(\(\d+(, ?\d+)?\))?\z/- ADAPTER_FAMILIES =
Which family of spellings an adapter belongs to. MariaDB answers to the mysql2 adapter and is counted with MySQL, though the two part company over JSON. An adapter nobody has classified keeps the standard spellings and is left to say for itself what it cannot do.
pglite is PostgreSQL itself compiled to WebAssembly, reached through wasmify-rails' adapter; the server it answers for is the same one.
{ 'sqlite3' => :sqlite, 'postgresql' => :postgresql, 'postgis' => :postgresql, 'pglite' => :postgresql, 'mysql2' => :mysql, 'trilogy' => :mysql, }.freeze
Class Method Summary collapse
Class Method Details
.adapter_family(model) ⇒ Object
30 31 32 |
# File 'lib/active_record/refined/ast.rb', line 30 def self.adapter_family(model) ADAPTER_FAMILIES[model.connection_db_config.adapter] || :unknown end |
.check_name(name, pattern, what) ⇒ Object
34 35 36 37 |
# File 'lib/active_record/refined/ast.rb', line 34 def self.check_name(name, pattern, what) return name if pattern.match?(name.to_s) raise ArgumentError, "#{name.inspect} is not a plain #{what}" end |