torque-postgresql 4.0.1 → 4.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +52 -0
- data/lib/generators/torque/skill_generator.rb +17 -0
- data/lib/generators/torque/templates/trigger.sql.erb +3 -0
- data/lib/generators/torque/trigger_generator.rb +13 -0
- data/lib/torque/postgresql/adapter/database_statements.rb +98 -7
- data/lib/torque/postgresql/adapter/inheritance_statements.rb +297 -0
- data/lib/torque/postgresql/adapter/oid/array.rb +13 -0
- data/lib/torque/postgresql/adapter/oid/box.rb +1 -1
- data/lib/torque/postgresql/adapter/oid/circle.rb +1 -1
- data/lib/torque/postgresql/adapter/oid/composite.rb +117 -0
- data/lib/torque/postgresql/adapter/oid/enum.rb +1 -1
- data/lib/torque/postgresql/adapter/oid/enum_set.rb +2 -2
- data/lib/torque/postgresql/adapter/oid/interval.rb +1 -1
- data/lib/torque/postgresql/adapter/oid/line.rb +1 -1
- data/lib/torque/postgresql/adapter/oid/lquery.rb +70 -0
- data/lib/torque/postgresql/adapter/oid/ltree.rb +111 -0
- data/lib/torque/postgresql/adapter/oid/segment.rb +1 -1
- data/lib/torque/postgresql/adapter/oid/struct.rb +150 -0
- data/lib/torque/postgresql/adapter/oid/struct_list.rb +52 -0
- data/lib/torque/postgresql/adapter/oid/struct_set.rb +38 -0
- data/lib/torque/postgresql/adapter/oid.rb +13 -0
- data/lib/torque/postgresql/adapter/quoting.rb +11 -2
- data/lib/torque/postgresql/adapter/schema_definitions.rb +51 -0
- data/lib/torque/postgresql/adapter/schema_dumper.rb +27 -0
- data/lib/torque/postgresql/adapter/schema_statements.rb +207 -0
- data/lib/torque/postgresql/adapter.rb +2 -5
- data/lib/torque/postgresql/arel/nodes.rb +114 -1
- data/lib/torque/postgresql/arel/visitors.rb +65 -8
- data/lib/torque/postgresql/associations/join_dependency.rb +55 -0
- data/lib/torque/postgresql/associations.rb +3 -0
- data/lib/torque/postgresql/attributes/base.rb +97 -0
- data/lib/torque/postgresql/attributes/composite.rb +98 -0
- data/lib/torque/postgresql/attributes/enum.rb +13 -7
- data/lib/torque/postgresql/attributes/lquery.rb +120 -0
- data/lib/torque/postgresql/attributes/ltree.rb +121 -0
- data/lib/torque/postgresql/attributes/simple_enum.rb +72 -0
- data/lib/torque/postgresql/attributes/struct.rb +137 -0
- data/lib/torque/postgresql/base.rb +26 -15
- data/lib/torque/postgresql/config.rb +100 -15
- data/lib/torque/postgresql/geometry_builder.rb +4 -10
- data/lib/torque/postgresql/inheritance/expander.rb +66 -0
- data/lib/torque/postgresql/inheritance/record.rb +52 -0
- data/lib/torque/postgresql/inheritance.rb +141 -68
- data/lib/torque/postgresql/migration/command_recorder.rb +76 -0
- data/lib/torque/postgresql/predicate_builder/arel_attribute_handler.rb +1 -1
- data/lib/torque/postgresql/predicate_builder/array_handler.rb +16 -8
- data/lib/torque/postgresql/predicate_builder/composite_handler.rb +122 -0
- data/lib/torque/postgresql/predicate_builder/ltree_handler.rb +112 -0
- data/lib/torque/postgresql/predicate_builder/struct_handler.rb +88 -0
- data/lib/torque/postgresql/predicate_builder.rb +53 -0
- data/lib/torque/postgresql/predicate_table.rb +61 -0
- data/lib/torque/postgresql/railtie.rb +52 -0
- data/lib/torque/postgresql/relation/auxiliary_statement.rb +7 -3
- data/lib/torque/postgresql/relation/buckets.rb +2 -1
- data/lib/torque/postgresql/relation/cross_join.rb +193 -0
- data/lib/torque/postgresql/relation/inheritance.rb +145 -28
- data/lib/torque/postgresql/relation/join_series.rb +1 -0
- data/lib/torque/postgresql/relation/merger.rb +30 -5
- data/lib/torque/postgresql/relation/segments.rb +140 -0
- data/lib/torque/postgresql/relation.rb +32 -12
- data/lib/torque/postgresql/schema_cache.rb +1 -0
- data/lib/torque/postgresql/validations.rb +29 -0
- data/lib/torque/postgresql/version.rb +1 -1
- data/lib/torque/postgresql/versioned_commands/command_migration.rb +24 -1
- data/lib/torque/postgresql/versioned_commands.rb +39 -0
- data/lib/torque/postgresql.rb +4 -0
- data/sig/generators/torque/function_generator.rbs +9 -0
- data/sig/generators/torque/skill_generator.rbs +7 -0
- data/sig/generators/torque/trigger_generator.rbs +9 -0
- data/sig/generators/torque/type_generator.rbs +9 -0
- data/sig/generators/torque/view_generator.rbs +9 -0
- data/sig/manifest.yaml +7 -0
- data/sig/torque/postgresql/adapter/database_statements.rbs +42 -0
- data/sig/torque/postgresql/adapter/inheritance_statements.rbs +36 -0
- data/sig/torque/postgresql/adapter/oid/array.rbs +20 -0
- data/sig/torque/postgresql/adapter/oid/box.rbs +28 -0
- data/sig/torque/postgresql/adapter/oid/circle.rbs +33 -0
- data/sig/torque/postgresql/adapter/oid/composite.rbs +35 -0
- data/sig/torque/postgresql/adapter/oid/enum.rbs +28 -0
- data/sig/torque/postgresql/adapter/oid/enum_set.rbs +19 -0
- data/sig/torque/postgresql/adapter/oid/interval.rbs +20 -0
- data/sig/torque/postgresql/adapter/oid/line.rbs +33 -0
- data/sig/torque/postgresql/adapter/oid/lquery.rbs +21 -0
- data/sig/torque/postgresql/adapter/oid/ltree.rbs +32 -0
- data/sig/torque/postgresql/adapter/oid/range.rbs +28 -0
- data/sig/torque/postgresql/adapter/oid/segment.rbs +38 -0
- data/sig/torque/postgresql/adapter/oid/struct.rbs +41 -0
- data/sig/torque/postgresql/adapter/oid/struct_list.rbs +20 -0
- data/sig/torque/postgresql/adapter/oid/struct_set.rbs +18 -0
- data/sig/torque/postgresql/adapter/oid.rbs +9 -0
- data/sig/torque/postgresql/adapter/quoting.rbs +20 -0
- data/sig/torque/postgresql/adapter/schema_creation.rbs +13 -0
- data/sig/torque/postgresql/adapter/schema_definitions.rbs +55 -0
- data/sig/torque/postgresql/adapter/schema_dumper.rbs +37 -0
- data/sig/torque/postgresql/adapter/schema_overrides.rbs +46 -0
- data/sig/torque/postgresql/adapter/schema_statements.rbs +50 -0
- data/sig/torque/postgresql/adapter.rbs +24 -0
- data/sig/torque/postgresql/arel/infix_operation.rbs +79 -0
- data/sig/torque/postgresql/arel/join_source.rbs +19 -0
- data/sig/torque/postgresql/arel/nodes.rbs +83 -0
- data/sig/torque/postgresql/arel/operations.rbs +28 -0
- data/sig/torque/postgresql/arel/select_manager.rbs +15 -0
- data/sig/torque/postgresql/arel/visitors.rbs +30 -0
- data/sig/torque/postgresql/arel.rbs +6 -0
- data/sig/torque/postgresql/associations/association_scope.rbs +28 -0
- data/sig/torque/postgresql/associations/belongs_to_many_association.rbs +51 -0
- data/sig/torque/postgresql/associations/builder/belongs_to_many.rbs +24 -0
- data/sig/torque/postgresql/associations/builder/has_many.rbs +15 -0
- data/sig/torque/postgresql/associations/builder.rbs +8 -0
- data/sig/torque/postgresql/associations/foreign_association.rbs +16 -0
- data/sig/torque/postgresql/associations/join_dependency.rbs +16 -0
- data/sig/torque/postgresql/associations/preloader/association.rbs +32 -0
- data/sig/torque/postgresql/associations/preloader/loader_query.rbs +20 -0
- data/sig/torque/postgresql/associations/preloader.rbs +8 -0
- data/sig/torque/postgresql/associations.rbs +17 -0
- data/sig/torque/postgresql/attributes/base.rbs +37 -0
- data/sig/torque/postgresql/attributes/builder/enum.rbs +38 -0
- data/sig/torque/postgresql/attributes/builder/full_text_search.rbs +27 -0
- data/sig/torque/postgresql/attributes/builder/period.rbs +106 -0
- data/sig/torque/postgresql/attributes/builder.rbs +19 -0
- data/sig/torque/postgresql/attributes/composite.rbs +28 -0
- data/sig/torque/postgresql/attributes/enum.rbs +69 -0
- data/sig/torque/postgresql/attributes/enum_set.rbs +75 -0
- data/sig/torque/postgresql/attributes/full_text_search.rbs +13 -0
- data/sig/torque/postgresql/attributes/lazy.rbs +17 -0
- data/sig/torque/postgresql/attributes/lquery.rbs +48 -0
- data/sig/torque/postgresql/attributes/ltree.rbs +46 -0
- data/sig/torque/postgresql/attributes/period.rbs +13 -0
- data/sig/torque/postgresql/attributes/simple_enum.rbs +39 -0
- data/sig/torque/postgresql/attributes/struct.rbs +38 -0
- data/sig/torque/postgresql/attributes.rbs +6 -0
- data/sig/torque/postgresql/autosave_association.rbs +16 -0
- data/sig/torque/postgresql/auxiliary_statement/recursive.rbs +22 -0
- data/sig/torque/postgresql/auxiliary_statement/settings.rbs +63 -0
- data/sig/torque/postgresql/auxiliary_statement.rbs +57 -0
- data/sig/torque/postgresql/base.rbs +41 -0
- data/sig/torque/postgresql/collector.rbs +7 -0
- data/sig/torque/postgresql/config.rbs +9 -0
- data/sig/torque/postgresql/function.rbs +21 -0
- data/sig/torque/postgresql/geometry_builder.rbs +20 -0
- data/sig/torque/postgresql/i18n.rbs +15 -0
- data/sig/torque/postgresql/inheritance/expander.rbs +23 -0
- data/sig/torque/postgresql/inheritance/record.rbs +20 -0
- data/sig/torque/postgresql/inheritance.rbs +47 -0
- data/sig/torque/postgresql/insert_all.rbs +22 -0
- data/sig/torque/postgresql/migration/command_recorder.rbs +30 -0
- data/sig/torque/postgresql/migration.rbs +6 -0
- data/sig/torque/postgresql/predicate_builder/arel_attribute_handler.rbs +15 -0
- data/sig/torque/postgresql/predicate_builder/array_handler.rbs +26 -0
- data/sig/torque/postgresql/predicate_builder/composite_handler.rbs +26 -0
- data/sig/torque/postgresql/predicate_builder/enumerator_lazy_handler.rbs +18 -0
- data/sig/torque/postgresql/predicate_builder/ltree_handler.rbs +36 -0
- data/sig/torque/postgresql/predicate_builder/regexp_handler.rbs +16 -0
- data/sig/torque/postgresql/predicate_builder/struct_handler.rbs +24 -0
- data/sig/torque/postgresql/predicate_builder.rbs +23 -0
- data/sig/torque/postgresql/predicate_table.rbs +24 -0
- data/sig/torque/postgresql/railtie.rbs +10 -0
- data/sig/torque/postgresql/reflection/abstract_reflection.rbs +22 -0
- data/sig/torque/postgresql/reflection/association_reflection.rbs +18 -0
- data/sig/torque/postgresql/reflection/belongs_to_many_reflection.rbs +30 -0
- data/sig/torque/postgresql/reflection/has_many_reflection.rbs +14 -0
- data/sig/torque/postgresql/reflection/runtime_reflection.rbs +18 -0
- data/sig/torque/postgresql/reflection/through_reflection.rbs +14 -0
- data/sig/torque/postgresql/reflection.rbs +11 -0
- data/sig/torque/postgresql/relation/auxiliary_statement.rbs +29 -0
- data/sig/torque/postgresql/relation/buckets.rbs +35 -0
- data/sig/torque/postgresql/relation/cross_join.rbs +63 -0
- data/sig/torque/postgresql/relation/distinct_on.rbs +16 -0
- data/sig/torque/postgresql/relation/inheritance.rbs +48 -0
- data/sig/torque/postgresql/relation/join_series.rbs +28 -0
- data/sig/torque/postgresql/relation/merger.rbs +23 -0
- data/sig/torque/postgresql/relation/segments.rbs +27 -0
- data/sig/torque/postgresql/relation.rbs +48 -0
- data/sig/torque/postgresql/schema_cache/bound_schema_reflection.rbs +14 -0
- data/sig/torque/postgresql/schema_cache/inheritance.rbs +12 -0
- data/sig/torque/postgresql/schema_cache/schema_reflection.rbs +14 -0
- data/sig/torque/postgresql/schema_cache.rbs +43 -0
- data/sig/torque/postgresql/table_name.rbs +20 -0
- data/sig/torque/postgresql/validations.rbs +13 -0
- data/sig/torque/postgresql/version.rbs +5 -0
- data/sig/torque/postgresql/versioned_commands/command_migration.rbs +54 -0
- data/sig/torque/postgresql/versioned_commands/generator.rbs +17 -0
- data/sig/torque/postgresql/versioned_commands/migration_context.rbs +30 -0
- data/sig/torque/postgresql/versioned_commands/migrator.rbs +19 -0
- data/sig/torque/postgresql/versioned_commands/schema_table.rbs +23 -0
- data/sig/torque/postgresql/versioned_commands.rbs +25 -0
- data/sig/torque/postgresql.rbs +26 -0
- data/skills/torque-postgresql/SKILL.md +70 -0
- data/spec/fixtures/migrations/20250101000008_create_trigger_audit_users_v1.sql +3 -0
- data/spec/initialize.rb +29 -2
- data/spec/mocks/cache_query.rb +13 -1
- data/spec/models/author.rb +1 -1
- data/spec/models/comment.rb +2 -0
- data/spec/models/place.rb +2 -0
- data/spec/models/profile.rb +31 -0
- data/spec/rbs_helper.rb +8 -0
- data/spec/schema.rb +35 -4
- data/spec/spec_helper.rb +1 -0
- data/spec/tests/arel_spec.rb +3 -3
- data/spec/tests/auxiliary_statement_spec.rb +12 -0
- data/spec/tests/buckets_spec.rb +122 -0
- data/spec/tests/composite_spec.rb +867 -0
- data/spec/tests/cross_join_spec.rb +185 -0
- data/spec/tests/distinct_on_spec.rb +5 -0
- data/spec/tests/enum_set_spec.rb +4 -0
- data/spec/tests/enum_spec.rb +20 -4
- data/spec/tests/geometric_builder_spec.rb +16 -5
- data/spec/tests/has_many_spec.rb +2 -1
- data/spec/tests/interval_spec.rb +6 -0
- data/spec/tests/ltree_spec.rb +886 -0
- data/spec/tests/predicate_builder_spec.rb +120 -0
- data/spec/tests/relation_spec.rb +25 -69
- data/spec/tests/segments_spec.rb +264 -0
- data/spec/tests/struct_spec.rb +1170 -0
- data/spec/tests/table_inheritance_spec.rb +1037 -56
- data/spec/tests/versioned_commands_spec.rb +145 -0
- metadata +198 -2
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Attributes
|
|
4
|
+
class Struct < Base
|
|
5
|
+
type struct_class = Class | String | Symbol
|
|
6
|
+
type delegate = column_ref | Array[column_ref] | nil
|
|
7
|
+
|
|
8
|
+
class Uninitialized < ActiveModel::Attribute::Uninitialized
|
|
9
|
+
def original_value: () -> nil
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
@strict: bool
|
|
13
|
+
@_struct_default_attributes: ActiveModel::AttributeSet
|
|
14
|
+
|
|
15
|
+
def self.strict=: (bool value) -> bool
|
|
16
|
+
def self.strict?: () -> bool
|
|
17
|
+
def self._default_attributes: () -> ActiveModel::AttributeSet
|
|
18
|
+
def self.include_on: (model klass, ?Symbol? method_name) -> untyped
|
|
19
|
+
def self.build_on: (model model, column_ref column, struct_class klass, ?default: untyped, ?array: bool?, ?delegate: delegate, ?backfill: Adapter::OID::Struct::backfill, ?strict: bool?) -> untyped
|
|
20
|
+
|
|
21
|
+
private
|
|
22
|
+
|
|
23
|
+
def self.reset_default_attributes!: () -> untyped
|
|
24
|
+
def self.resolve_default_on: (model model, String column, Proc | Symbol default) -> untyped
|
|
25
|
+
|
|
26
|
+
public
|
|
27
|
+
|
|
28
|
+
def attribute_writer_missing: (column_ref name, untyped value) -> untyped
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
class Struct = Attributes::Struct
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
class ActiveRecord::Base
|
|
37
|
+
def self.struct_for: (Torque::PostgreSQL::column_ref column, Torque::PostgreSQL::Attributes::Struct::struct_class struct_klass, ?default: untyped, ?array: bool?, ?delegate: Torque::PostgreSQL::Attributes::Struct::delegate, ?backfill: Torque::PostgreSQL::Adapter::OID::Struct::backfill, ?strict: bool?) -> untyped
|
|
38
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module AutosaveAssociation
|
|
4
|
+
module ClassMethods
|
|
5
|
+
def add_autosave_association_callbacks: (reflection reflection) -> untyped
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def save_belongs_to_many_association: (reflection reflection) -> untyped
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
class ActiveRecord::Base
|
|
14
|
+
extend Torque::PostgreSQL::AutosaveAssociation::ClassMethods
|
|
15
|
+
include Torque::PostgreSQL::AutosaveAssociation
|
|
16
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
class AuxiliaryStatement
|
|
4
|
+
class Recursive < AuxiliaryStatement
|
|
5
|
+
@connect: [Symbol, Symbol] | Array[column_ref] | nil
|
|
6
|
+
@union_all: bool?
|
|
7
|
+
@sub_query: query?
|
|
8
|
+
@depth: [String, untyped, String?]?
|
|
9
|
+
@path: [String, String?, String?]?
|
|
10
|
+
|
|
11
|
+
def initialize: (*untyped, **untyped options) -> void
|
|
12
|
+
|
|
13
|
+
private
|
|
14
|
+
|
|
15
|
+
def build_query: (relation base) -> (arel_node | ::Arel::SelectManager)
|
|
16
|
+
def prepare: (relation base, Settings | OpenStruct settings) -> untyped
|
|
17
|
+
def prepare_sub_query: (relation base, Settings | OpenStruct settings) -> untyped
|
|
18
|
+
def extra_columns: (relation base, Array[arel_node] columns, Array[arel_node] sub_columns) -> untyped
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
class AuxiliaryStatement
|
|
4
|
+
class Settings
|
|
5
|
+
attr_reader base: base
|
|
6
|
+
attr_reader source: statement_class
|
|
7
|
+
attr_reader depth: [String, untyped, String?]?
|
|
8
|
+
attr_reader path: [String, String?, String?]?
|
|
9
|
+
|
|
10
|
+
@recursive: bool?
|
|
11
|
+
@query: query?
|
|
12
|
+
@sub_query: query?
|
|
13
|
+
@connect: [Symbol, Symbol] | Array[column_ref] | nil
|
|
14
|
+
@union_all: bool?
|
|
15
|
+
@query_table: arel_table?
|
|
16
|
+
|
|
17
|
+
def attributes: (*untyped) -> Hash[untyped, untyped]?
|
|
18
|
+
def attributes=: (Hash[untyped, untyped] value) -> Hash[untyped, untyped]
|
|
19
|
+
alias select attributes
|
|
20
|
+
def join: (*untyped) -> Hash[untyped, untyped]?
|
|
21
|
+
def join=: (Hash[untyped, untyped] value) -> Hash[untyped, untyped]
|
|
22
|
+
def join_type: (*untyped) -> join_type?
|
|
23
|
+
def join_type=: (join_type value) -> join_type
|
|
24
|
+
def requires: (*untyped) -> (Symbol | Array[untyped] | nil)
|
|
25
|
+
def requires=: (Symbol | Array[untyped] value) -> (Symbol | Array[untyped])
|
|
26
|
+
def polymorphic: (*untyped) -> untyped
|
|
27
|
+
def polymorphic=: (untyped value) -> untyped
|
|
28
|
+
def through: (*untyped) -> (Symbol | String | nil)
|
|
29
|
+
def through=: (Symbol | String value) -> (Symbol | String)
|
|
30
|
+
def union_all: (*untyped) -> bool?
|
|
31
|
+
def union_all=: (bool value) -> bool
|
|
32
|
+
alias cte source
|
|
33
|
+
|
|
34
|
+
def relation_query?: (untyped obj) -> bool
|
|
35
|
+
def table: () -> arel_table
|
|
36
|
+
def table_name: () -> (String | Symbol)?
|
|
37
|
+
def sql: (String raw) -> ::Arel::Nodes::SqlLiteral
|
|
38
|
+
|
|
39
|
+
def initialize: (base base, statement_class source, ?bool? recursive) -> void
|
|
40
|
+
def base_name: () -> String
|
|
41
|
+
def base_table: () -> arel_table
|
|
42
|
+
def recursive?: () -> bool?
|
|
43
|
+
def depth?: () -> String?
|
|
44
|
+
def path?: () -> String?
|
|
45
|
+
def with_depth: (?column_ref name, ?start: untyped, ?as: column_ref?) -> [String, untyped, String?]?
|
|
46
|
+
def with_path: (?column_ref name, ?source: column_ref?, ?as: column_ref?) -> [String, String?, String?]?
|
|
47
|
+
def union_all!: () -> true?
|
|
48
|
+
def with_depth_and_path: () -> untyped
|
|
49
|
+
def query_table: () -> arel_table?
|
|
50
|
+
def col: (column_ref name) -> arel_attribute
|
|
51
|
+
alias column col
|
|
52
|
+
def query: (?query? value, ?untyped command) -> untyped
|
|
53
|
+
def sub_query: (?query? value, ?untyped command) -> untyped
|
|
54
|
+
def connect: (?column_ref | Hash[column_ref, column_ref] | Array[column_ref] | nil value) -> ([Symbol, Symbol] | Array[column_ref] | nil)
|
|
55
|
+
alias connect= connect
|
|
56
|
+
|
|
57
|
+
private
|
|
58
|
+
|
|
59
|
+
def sanitize_query: (query value, ?untyped command) -> untyped
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
class AuxiliaryStatement
|
|
4
|
+
type query = relation | ::Arel::SelectManager | String | Symbol | Proc | _Callable
|
|
5
|
+
type base = relation | model
|
|
6
|
+
type statement_class = AuxiliaryStatement | singleton(AuxiliaryStatement)
|
|
7
|
+
type join_type = :inner | :left | :right | :full
|
|
8
|
+
|
|
9
|
+
TABLE_COLUMN_AS_STRING: Regexp
|
|
10
|
+
|
|
11
|
+
@table: arel_table
|
|
12
|
+
@join: Hash[untyped, untyped]
|
|
13
|
+
@args: Hash[Symbol, untyped]
|
|
14
|
+
@where: Hash[untyped, untyped] | String
|
|
15
|
+
@select: Hash[untyped, untyped]
|
|
16
|
+
@join_type: join_type?
|
|
17
|
+
@dependencies: Array[untyped]
|
|
18
|
+
@query: query
|
|
19
|
+
@association: String?
|
|
20
|
+
|
|
21
|
+
def self.config: () -> (Proc | OpenStruct | nil)
|
|
22
|
+
def self.table_name: () -> (String | Symbol)?
|
|
23
|
+
def self.lookup: (Symbol | String name, model base) -> singleton(AuxiliaryStatement)
|
|
24
|
+
def self.instantiate: (Symbol statement, model | relation base, **untyped options) -> AuxiliaryStatement
|
|
25
|
+
def self.build: (Symbol statement, relation base, ?Array[untyped] bound_attributes, ?Array[::Arel::Nodes::Join] join_sources, **untyped options) -> [Array[untyped], ::Arel::Nodes::As]
|
|
26
|
+
def self.relation_query?: (untyped obj) -> bool
|
|
27
|
+
def self.arel_query?: (untyped obj) -> bool
|
|
28
|
+
def self.create: (String | Symbol | model | relation | Hash[Symbol, untyped] table_or_settings) ?{ (Settings) -> void } -> singleton(AuxiliaryStatement)
|
|
29
|
+
def self.configurator: (Proc | Hash[Symbol, untyped] | nil config) -> (Proc | OpenStruct | nil)
|
|
30
|
+
def self.configure: (base base, statement_class instance) -> (Settings | OpenStruct)
|
|
31
|
+
def self.table: () -> arel_table
|
|
32
|
+
|
|
33
|
+
def config: () -> (Proc | OpenStruct | nil)
|
|
34
|
+
def table: () -> arel_table
|
|
35
|
+
def table_name: () -> (String | Symbol)?
|
|
36
|
+
def relation: (*untyped) -> untyped
|
|
37
|
+
def configure: (base base, statement_class instance) -> (Settings | OpenStruct)
|
|
38
|
+
def relation_query?: (untyped obj) -> bool
|
|
39
|
+
|
|
40
|
+
attr_reader bound_attributes: Array[untyped]
|
|
41
|
+
attr_reader join_sources: Array[::Arel::Nodes::Join]
|
|
42
|
+
|
|
43
|
+
def initialize: (*untyped, **untyped options) -> void
|
|
44
|
+
def build: (relation base) -> [Array[untyped], ::Arel::Nodes::As]
|
|
45
|
+
|
|
46
|
+
private
|
|
47
|
+
|
|
48
|
+
def prepare: (relation base, Settings | OpenStruct settings) -> untyped
|
|
49
|
+
def build_query: (relation base) -> (arel_node | ::Arel::SelectManager)
|
|
50
|
+
def build_join: (relation base) -> ::Arel::Nodes::Join
|
|
51
|
+
def arel_join: () -> singleton(::Arel::Nodes::Join)
|
|
52
|
+
def expose_columns: (relation base, ?arel_table? query_table) -> Array[arel_node]
|
|
53
|
+
def ensure_dependencies: (Array[untyped] list, relation base) -> Array[untyped]
|
|
54
|
+
def project: (column_ref | arel_node column, ?arel_table? arel_table) -> arel_node
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Base
|
|
4
|
+
extend ActiveSupport::Concern
|
|
5
|
+
|
|
6
|
+
module ClassMethods
|
|
7
|
+
def distinct_on: (*Relation::column_spec value) -> relation
|
|
8
|
+
def with: (*Relation::AuxiliaryStatement::statement args, ?recursive: bool, **untyped settings) -> relation
|
|
9
|
+
def itself_only: () -> relation
|
|
10
|
+
def expand_records: (*model types, ?eager_load: bool, ?filter: bool) -> relation
|
|
11
|
+
def join_series: (untyped range, ?with: Relation::JoinSeries::with?, ?as: column_ref, ?step: Relation::JoinSeries::step?, ?time_zone: untyped, ?cast: column_ref?, ?mode: Symbol) ?{ (Torque::PostgreSQL::Arel::Nodes::Ref series, arel_table table) -> arel_node } -> relation
|
|
12
|
+
def buckets: (Relation::column_spec | arel_node attribute, Relation::Buckets::keys values, ?count: Integer?, ?cast: column_ref?, ?as: column_ref?) -> relation
|
|
13
|
+
def segments: (**Relation::Segments::condition map) -> relation
|
|
14
|
+
def arel_property_of: (column_ref column, *column_ref | Integer path) -> Torque::PostgreSQL::Arel::Nodes::Property
|
|
15
|
+
def load_schema!: () -> untyped
|
|
16
|
+
def reset_table_name: () -> (String | TableName)
|
|
17
|
+
def inherited: (model subclass) -> untyped
|
|
18
|
+
def belongs_to_many: (Symbol name, ?Proc? scope, ?class_name: String, ?foreign_key: column_ref, ?primary_key: column_ref, ?dependent: Symbol, ?touch: bool | Symbol, ?optional: bool, ?required: bool, ?default: Proc, ?inverse_of: Symbol, ?autosave: bool, ?validate: bool, **untyped options) ?{ (?) -> untyped } -> untyped
|
|
19
|
+
def dynamic_attribute: (Symbol name) { (?) -> untyped } -> Symbol
|
|
20
|
+
def auxiliary_statement: (Symbol table) ?{ (AuxiliaryStatement::Settings) -> void } -> untyped
|
|
21
|
+
alias cte auxiliary_statement
|
|
22
|
+
def recursive_auxiliary_statement: (Symbol table) ?{ (AuxiliaryStatement::Settings) -> void } -> untyped
|
|
23
|
+
alias recursive_cte recursive_auxiliary_statement
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
class ActiveRecord::Base
|
|
30
|
+
include Torque::PostgreSQL::Base
|
|
31
|
+
extend Torque::PostgreSQL::Base::ClassMethods
|
|
32
|
+
|
|
33
|
+
def self.belongs_to_many_required_by_default: () -> bool?
|
|
34
|
+
def self.belongs_to_many_required_by_default=: (bool? value) -> bool?
|
|
35
|
+
def self.schema: () -> (String | Symbol | nil)
|
|
36
|
+
def self.schema=: (String | Symbol | nil value) -> (String | Symbol | nil)
|
|
37
|
+
def schema: () -> (String | Symbol | nil)
|
|
38
|
+
def self.auxiliary_statements_list: () -> Hash[Symbol, singleton(Torque::PostgreSQL::AuxiliaryStatement)]
|
|
39
|
+
def self.auxiliary_statements_list=: (Hash[Symbol, singleton(Torque::PostgreSQL::AuxiliaryStatement)] value) -> Hash[Symbol, singleton(Torque::PostgreSQL::AuxiliaryStatement)]
|
|
40
|
+
def auxiliary_statements_list: () -> Hash[Symbol, singleton(Torque::PostgreSQL::AuxiliaryStatement)]
|
|
41
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Function
|
|
4
|
+
def self.bind: (column_ref name, untyped value, type_caster | ActiveModel::Attributes::Normalization::NormalizedValueType type, ?untyped original_attribute) -> ::Arel::Nodes::BindParam
|
|
5
|
+
def self.bind_for: (model model, column_ref attribute, untyped value) -> ::Arel::Nodes::BindParam
|
|
6
|
+
def self.bind_with: (arel_attribute arel_attribute, untyped value) -> ::Arel::Nodes::BindParam
|
|
7
|
+
def self.bind_type: (untyped value, ?Symbol | type_caster | nil type, ?name: column_ref, ?cast: column_ref?) -> (::Arel::Nodes::BindParam | Arel::Nodes::Cast)
|
|
8
|
+
def self.infix: (Symbol | String op, arel_node left, arel_node right) -> ::Arel::Nodes::InfixOperation
|
|
9
|
+
def self.concat: (*arel_node args) -> arel_node
|
|
10
|
+
def self.group_by: (arel_node arel, column_ref name) -> Arel::Nodes::Ref
|
|
11
|
+
def self.respond_to_missing?: (*untyped) -> true
|
|
12
|
+
def self.method_missing: (Symbol name, *untyped args) ?{ (?) -> untyped } -> ::Arel::Nodes::NamedFunction
|
|
13
|
+
|
|
14
|
+
private
|
|
15
|
+
|
|
16
|
+
def self.ruby_type_to_model_type: (untyped value) -> (Symbol | Adapter::OID::Interval)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
FN: singleton(Function)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
class GeometryBuilder < ActiveModel::Type::Value
|
|
4
|
+
DESTRUCTOR: Regexp
|
|
5
|
+
NUMBER_SERIALIZER: ^(Numeric) -> String
|
|
6
|
+
|
|
7
|
+
def type: () -> (Symbol | String)
|
|
8
|
+
def pieces: () -> Array[Symbol]
|
|
9
|
+
def formation: () -> String
|
|
10
|
+
def cast: (untyped value) -> untyped
|
|
11
|
+
def serialize: (untyped value) -> String?
|
|
12
|
+
def deserialize: (String? value) -> untyped
|
|
13
|
+
def type_cast_for_schema: (untyped value) -> (Array[Numeric] | String)
|
|
14
|
+
def changed_in_place?: (String? raw_old_value, untyped new_value) -> bool
|
|
15
|
+
def number_serializer: () -> ^(Numeric) -> String
|
|
16
|
+
def config_class: () -> Class
|
|
17
|
+
def build_klass: (*untyped args) -> untyped
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module I18n
|
|
4
|
+
def localize: (Symbol | String locale, untyped object, ?Symbol | String format, ?Hash[Symbol, untyped] options) -> String
|
|
5
|
+
end
|
|
6
|
+
end
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
module I18n
|
|
10
|
+
module Backend
|
|
11
|
+
module Base
|
|
12
|
+
prepend Torque::PostgreSQL::I18n
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Inheritance
|
|
4
|
+
class Expander
|
|
5
|
+
@model: model
|
|
6
|
+
@records: Array[record]
|
|
7
|
+
@targets: Array[model]
|
|
8
|
+
|
|
9
|
+
def initialize: (model model, Array[record] records, Array[model] targets) -> void
|
|
10
|
+
def call: () -> Array[record]
|
|
11
|
+
|
|
12
|
+
private
|
|
13
|
+
|
|
14
|
+
def model: () -> model
|
|
15
|
+
def targets: () -> Array[model]
|
|
16
|
+
def pending: () -> Hash[model, Array[record]]
|
|
17
|
+
def extra_columns: (model klass) -> Array[String]
|
|
18
|
+
def fetch: (model klass, Array[untyped] ids) -> Hash[untyped, Hash[String, untyped]]
|
|
19
|
+
def amend: (model klass, Array[record] records, Hash[untyped, Hash[String, untyped]] rows) -> untyped
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Inheritance
|
|
4
|
+
module Record
|
|
5
|
+
@partial_record: bool?
|
|
6
|
+
@readonly: bool
|
|
7
|
+
|
|
8
|
+
def partial_record?: () -> bool
|
|
9
|
+
def reload: (*untyped) -> self
|
|
10
|
+
def destroy: () -> untyped
|
|
11
|
+
|
|
12
|
+
private
|
|
13
|
+
|
|
14
|
+
def without_readonly: () { () -> untyped } -> untyped
|
|
15
|
+
def mark_as_partial_record!: () -> untyped
|
|
16
|
+
def mark_as_full_record!: () -> bool
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
class InheritanceError < ArgumentError
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
module Inheritance
|
|
7
|
+
extend ActiveSupport::Concern
|
|
8
|
+
|
|
9
|
+
type dependents = Hash[String, model]
|
|
10
|
+
|
|
11
|
+
module ClassMethods
|
|
12
|
+
def _record_class_attribute: () -> Symbol
|
|
13
|
+
def _record_class_column_name: () -> String
|
|
14
|
+
def inheritance_merged_attributes: () -> Array[String]
|
|
15
|
+
def inheritance_mergeable_attributes: () -> Array[String]
|
|
16
|
+
def physically_inherited?: () -> bool
|
|
17
|
+
def inheritance_dependents: () -> Array[String]
|
|
18
|
+
def physically_inheritances?: () -> bool
|
|
19
|
+
def inheritance_column_prefix: () -> String
|
|
20
|
+
def physically_inheritance_root: () -> model
|
|
21
|
+
def inheritance_foreign_attribute_names: () -> Set[String]
|
|
22
|
+
def inheritance_dependent_prefixes: () -> Set[String]
|
|
23
|
+
def casted_dependents: () -> dependents
|
|
24
|
+
def inheritance_expandable_dependents: () -> dependents
|
|
25
|
+
def reset_table_name: () -> (String | TableName)
|
|
26
|
+
def decorated_table_name: () -> String
|
|
27
|
+
def base_class: () -> model
|
|
28
|
+
def primary_key: () -> (String | Array[String] | nil)
|
|
29
|
+
def compute_table_name: () -> (String | TableName)
|
|
30
|
+
def raise_unable_to_cast: (String record_class_value) -> bot
|
|
31
|
+
def reload_schema_from_cache: (?bool recursive) -> untyped
|
|
32
|
+
|
|
33
|
+
private
|
|
34
|
+
|
|
35
|
+
def inheritance_cache: (Symbol name) { () -> untyped } -> untyped
|
|
36
|
+
def instantiate_instance_of: (model klass, Hash[String, untyped] attributes, ?Hash[String, type_caster] types) ?{ (record) -> void } -> record
|
|
37
|
+
def sanitize_attributes: (model real_class, Hash[String, untyped] attributes, Hash[String, type_caster] types) -> [Hash[String, untyped], Hash[String, type_caster]]
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
class ActiveRecord::Base
|
|
44
|
+
include Torque::PostgreSQL::Inheritance
|
|
45
|
+
extend Torque::PostgreSQL::Inheritance::ClassMethods
|
|
46
|
+
include Torque::PostgreSQL::Inheritance::Record
|
|
47
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module InsertAll
|
|
4
|
+
attr_reader where: String | relation | nil
|
|
5
|
+
|
|
6
|
+
def initialize: (*untyped args, ?where: String | relation | nil, **untyped xargs) -> void
|
|
7
|
+
|
|
8
|
+
module Builder
|
|
9
|
+
def where: () -> (String | relation | nil)
|
|
10
|
+
def where_condition?: () -> bool
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
class ActiveRecord::InsertAll
|
|
17
|
+
prepend Torque::PostgreSQL::InsertAll
|
|
18
|
+
|
|
19
|
+
class Builder
|
|
20
|
+
include Torque::PostgreSQL::InsertAll::Builder
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Migration
|
|
4
|
+
module CommandRecorder
|
|
5
|
+
type inversion = [Symbol, Array[untyped]]
|
|
6
|
+
|
|
7
|
+
def rename_type: (*untyped args) ?{ (?) -> untyped } -> untyped
|
|
8
|
+
def invert_rename_type: (Array[untyped] args) ?{ (?) -> untyped } -> inversion
|
|
9
|
+
def create_composite_type: (*untyped args) ?{ (?) -> untyped } -> untyped
|
|
10
|
+
def invert_create_composite_type: (Array[untyped] args) ?{ (?) -> untyped } -> inversion
|
|
11
|
+
def change_composite_type: (*untyped args) ?{ (?) -> untyped } -> untyped
|
|
12
|
+
def add_composite_column: (*untyped args) ?{ (?) -> untyped } -> untyped
|
|
13
|
+
def invert_add_composite_column: (Array[untyped] args) ?{ (?) -> untyped } -> inversion
|
|
14
|
+
def remove_composite_column: (*untyped args) ?{ (?) -> untyped } -> untyped
|
|
15
|
+
def invert_remove_composite_column: (Array[untyped] args) ?{ (?) -> untyped } -> inversion
|
|
16
|
+
def change_composite_column: (*untyped args) ?{ (?) -> untyped } -> untyped
|
|
17
|
+
def rename_composite_column: (*untyped args) ?{ (?) -> untyped } -> untyped
|
|
18
|
+
def invert_rename_composite_column: (Array[untyped] args) ?{ (?) -> untyped } -> inversion
|
|
19
|
+
def sync_inheritance_features: (*untyped args) ?{ (?) -> untyped } -> untyped
|
|
20
|
+
def invert_sync_inheritance_features: (Array[untyped] args) ?{ (?) -> untyped } -> inversion
|
|
21
|
+
def create_schema: (*untyped args) ?{ (?) -> untyped } -> untyped
|
|
22
|
+
def invert_create_schema: (Array[untyped] args) ?{ (?) -> untyped } -> inversion
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
class ActiveRecord::Migration::CommandRecorder
|
|
29
|
+
include Torque::PostgreSQL::Migration::CommandRecorder
|
|
30
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module PredicateBuilder
|
|
4
|
+
class ArelAttributeHandler
|
|
5
|
+
def self.call: (arel_node attribute, arel_node value) -> arel_node
|
|
6
|
+
def initialize: (*untyped) -> void
|
|
7
|
+
def call: (arel_node attribute, arel_node value) -> arel_node
|
|
8
|
+
|
|
9
|
+
private
|
|
10
|
+
|
|
11
|
+
def array_typed?: (arel_node attribute) -> bool
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module PredicateBuilder
|
|
4
|
+
module ArrayHandler
|
|
5
|
+
def call: (arel_node attribute, untyped value) -> arel_node
|
|
6
|
+
def call_for_array: (arel_node attribute, untyped value) -> arel_node
|
|
7
|
+
|
|
8
|
+
private
|
|
9
|
+
|
|
10
|
+
def call_with_value: (arel_node attribute, untyped value) -> ::Arel::Nodes::InfixOperation
|
|
11
|
+
def call_with_array: (arel_node attribute, Array[untyped] value) -> ::Arel::Nodes::InfixOperation
|
|
12
|
+
def call_with_empty: (arel_node attribute) -> arel_node
|
|
13
|
+
def id_of: (untyped entry) -> untyped
|
|
14
|
+
def array_attribute?: (arel_node attribute) -> bool
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
class ActiveRecord::PredicateBuilder::ArrayHandler
|
|
21
|
+
prepend Torque::PostgreSQL::PredicateBuilder::ArrayHandler
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
class ActiveRecord::PredicateBuilder::BasicObjectHandler
|
|
25
|
+
prepend Torque::PostgreSQL::PredicateBuilder::ArrayHandler
|
|
26
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module PredicateBuilder
|
|
4
|
+
class CompositeHandler
|
|
5
|
+
@predicate_builder: ActiveRecord::PredicateBuilder
|
|
6
|
+
@composite: Adapter::OID::Composite?
|
|
7
|
+
|
|
8
|
+
def self.candidate?: (type_caster? type, ?untyped value) -> bool
|
|
9
|
+
def self.columns?: (untyped value) -> bool
|
|
10
|
+
def initialize: (ActiveRecord::PredicateBuilder predicate_builder) -> void
|
|
11
|
+
def call: (arel_node attribute, type_caster type, untyped value) -> arel_node
|
|
12
|
+
def table_for: (arel_node source, type_caster type) -> PredicateTable
|
|
13
|
+
def type_of: (column_ref name) -> [type_caster]
|
|
14
|
+
|
|
15
|
+
private
|
|
16
|
+
|
|
17
|
+
def predicate_builder: () -> ActiveRecord::PredicateBuilder
|
|
18
|
+
def composite: () -> Adapter::OID::Composite?
|
|
19
|
+
def call_for_record: (arel_node attribute, untyped value, bool array) -> arel_node
|
|
20
|
+
def call_for_array: (arel_node attribute, untyped value) -> arel_node
|
|
21
|
+
def conditions_for: (arel_node source, untyped value) -> arel_node
|
|
22
|
+
def group_for: (arel_node source, untyped entry) -> ::Arel::Nodes::Grouping
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module PredicateBuilder
|
|
4
|
+
class EnumeratorLazyHandler < ::ActiveRecord::PredicateBuilder::ArrayHandler
|
|
5
|
+
class Timeout < ::Timeout::Error
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def call: (arel_attribute attribute, Enumerator::Lazy[untyped, untyped] value) -> arel_node
|
|
9
|
+
|
|
10
|
+
private
|
|
11
|
+
|
|
12
|
+
def with_timeout: () { () -> arel_node } -> arel_node
|
|
13
|
+
def timeout: () -> Numeric?
|
|
14
|
+
def limit: () -> Integer?
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module PredicateBuilder
|
|
4
|
+
class LtreeHandler
|
|
5
|
+
@predicate_builder: ActiveRecord::PredicateBuilder
|
|
6
|
+
@attribute: arel_attribute
|
|
7
|
+
@column: Adapter::OID::Ltree
|
|
8
|
+
@array: bool
|
|
9
|
+
@list: bool
|
|
10
|
+
|
|
11
|
+
def self.candidate?: (type_caster? type) -> bool
|
|
12
|
+
def self.column_of: (type_caster? type) -> type_caster?
|
|
13
|
+
def initialize: (ActiveRecord::PredicateBuilder predicate_builder) -> void
|
|
14
|
+
def call: (arel_attribute attribute, type_caster type, untyped value) -> arel_node
|
|
15
|
+
|
|
16
|
+
private
|
|
17
|
+
|
|
18
|
+
def attribute: () -> arel_attribute
|
|
19
|
+
def column: () -> Adapter::OID::Ltree
|
|
20
|
+
def array: () -> bool
|
|
21
|
+
def list: () -> bool
|
|
22
|
+
def list?: (untyped value) -> bool
|
|
23
|
+
def lquery_column?: () -> bool
|
|
24
|
+
def lquery: () -> Adapter::OID::Lquery
|
|
25
|
+
def ltree: () -> Adapter::OID::Ltree
|
|
26
|
+
def bind: (untyped value, type_caster type) -> ::Arel::Nodes::BindParam
|
|
27
|
+
def equality: (Array[untyped] values) -> arel_node
|
|
28
|
+
def single_equality: (arel_node target, arel_node bind) -> arel_node
|
|
29
|
+
def empty_equality: (arel_node target) -> arel_node
|
|
30
|
+
def match: (Array[untyped] values) -> arel_node
|
|
31
|
+
def single_match: (arel_node bind) -> arel_node
|
|
32
|
+
def list_match: (arel_node binds) -> arel_node
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module PredicateBuilder
|
|
4
|
+
class RegexpHandler
|
|
5
|
+
@predicate_builder: ActiveRecord::PredicateBuilder
|
|
6
|
+
|
|
7
|
+
def initialize: (ActiveRecord::PredicateBuilder predicate_builder) -> void
|
|
8
|
+
def call: (arel_attribute attribute, Regexp value) -> ::Arel::Nodes::InfixOperation
|
|
9
|
+
|
|
10
|
+
private
|
|
11
|
+
|
|
12
|
+
def predicate_builder: () -> ActiveRecord::PredicateBuilder
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module PredicateBuilder
|
|
4
|
+
class StructHandler
|
|
5
|
+
PLAIN_TYPES: Array[Symbol]
|
|
6
|
+
|
|
7
|
+
@predicate_builder: ActiveRecord::PredicateBuilder
|
|
8
|
+
@struct: type_caster?
|
|
9
|
+
|
|
10
|
+
def self.candidate?: (type_caster? type, ?untyped value) -> bool
|
|
11
|
+
def initialize: (ActiveRecord::PredicateBuilder predicate_builder) -> void
|
|
12
|
+
def call: (arel_node attribute, type_caster struct, Hash[untyped, untyped] value) -> ::Arel::Nodes::Grouping
|
|
13
|
+
def table_for: (arel_node attribute, type_caster? struct) -> PredicateTable
|
|
14
|
+
def property_for: (arel_node attribute, type_caster? struct, Array[path_key] path) -> arel_node
|
|
15
|
+
def type_of: (path_key name) -> [type_caster?, String?]
|
|
16
|
+
|
|
17
|
+
private
|
|
18
|
+
|
|
19
|
+
def predicate_builder: () -> ActiveRecord::PredicateBuilder
|
|
20
|
+
def cast_for: (type_caster? type) -> String?
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|