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,23 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
# initialize is not declared: the handler files reopen this module before
|
|
4
|
+
# it is defined, and the runtime checker hooks it eagerly
|
|
5
|
+
module PredicateBuilder
|
|
6
|
+
type handler = singleton(CompositeHandler) | singleton(StructHandler) | singleton(LtreeHandler)
|
|
7
|
+
|
|
8
|
+
ARRAY_OID: singleton(ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Array)
|
|
9
|
+
|
|
10
|
+
def self.handler_for: (type_caster? type, ?untyped value) -> handler?
|
|
11
|
+
def build: (arel_node attribute, untyped value, ?Symbol? operator) -> arel_node
|
|
12
|
+
def resolve_arel_attribute: (column_ref table_name, column_ref column_name) ?{ (?) -> untyped } -> arel_node
|
|
13
|
+
|
|
14
|
+
private
|
|
15
|
+
|
|
16
|
+
def handler_for_path: (arel_node attribute, untyped value) -> singleton(StructHandler)?
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
class ActiveRecord::PredicateBuilder
|
|
22
|
+
prepend Torque::PostgreSQL::PredicateBuilder
|
|
23
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
class PredicateTable
|
|
4
|
+
type handler = PredicateBuilder::CompositeHandler | PredicateBuilder::StructHandler
|
|
5
|
+
type node = Arel::Nodes::Column | Arel::Nodes::Property
|
|
6
|
+
|
|
7
|
+
@handler: handler
|
|
8
|
+
@source: arel_node
|
|
9
|
+
@node: singleton(::Arel::Nodes::Binary)
|
|
10
|
+
|
|
11
|
+
def initialize: (handler handler, arel_node source, singleton(::Arel::Nodes::Binary) node) -> void
|
|
12
|
+
def arel_table: () -> self
|
|
13
|
+
def []: (column_ref | Integer name) -> node
|
|
14
|
+
def type: (column_ref | Integer name) -> type_caster?
|
|
15
|
+
def has_column?: (*untyped) -> true
|
|
16
|
+
def primary_key: () -> nil
|
|
17
|
+
def associated_with: (*untyped) -> false
|
|
18
|
+
alias associated_with? associated_with
|
|
19
|
+
def aggregated_with?: (*untyped) -> false
|
|
20
|
+
def polymorphic_association?: () -> false
|
|
21
|
+
def through_association?: () -> false
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Reflection
|
|
4
|
+
module AbstractReflection
|
|
5
|
+
AREL_ATTR: singleton(::Arel::Attributes::Attribute)
|
|
6
|
+
AREL_NODE: singleton(::Arel::Nodes::Node)
|
|
7
|
+
|
|
8
|
+
def connected_through_array?: () -> bool
|
|
9
|
+
def join_scope: (table_node table, table_node foreign_table, model | relation foreign_klass) -> relation
|
|
10
|
+
def build_join_constraint: (table_node table, table_node foreign_table) -> arel_node
|
|
11
|
+
|
|
12
|
+
private
|
|
13
|
+
|
|
14
|
+
def build_id_constraint_between: (table_node table, table_node foreign_table) -> arel_node
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
class ActiveRecord::Reflection::AbstractReflection
|
|
21
|
+
prepend Torque::PostgreSQL::Reflection::AbstractReflection
|
|
22
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Reflection
|
|
4
|
+
module AssociationReflection
|
|
5
|
+
def initialize: (Symbol name, Proc? scope, Hash[Symbol, untyped] options, model active_record) -> void
|
|
6
|
+
|
|
7
|
+
private
|
|
8
|
+
|
|
9
|
+
def derive_foreign_key: (*untyped, **untyped) -> String
|
|
10
|
+
def automatic_inverse_of: () -> Symbol?
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
class ActiveRecord::Reflection::AssociationReflection
|
|
17
|
+
prepend Torque::PostgreSQL::Reflection::AssociationReflection
|
|
18
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Reflection
|
|
4
|
+
class BelongsToManyReflection < ::ActiveRecord::Reflection::AssociationReflection
|
|
5
|
+
@foreign_key: String
|
|
6
|
+
@association_foreign_key: String
|
|
7
|
+
@active_record_primary_key: String?
|
|
8
|
+
|
|
9
|
+
def macro: () -> :belongs_to_many
|
|
10
|
+
def connected_through_array?: () -> true
|
|
11
|
+
def belongs_to?: () -> true
|
|
12
|
+
def collection?: () -> true
|
|
13
|
+
def association_class: () -> singleton(Associations::BelongsToManyAssociation)
|
|
14
|
+
def foreign_key: () -> String
|
|
15
|
+
def association_foreign_key: () -> String
|
|
16
|
+
def active_record_primary_key: () -> String?
|
|
17
|
+
def join_primary_key: (*untyped) -> String?
|
|
18
|
+
def join_foreign_key: () -> String
|
|
19
|
+
def array_attribute: () -> arel_attribute
|
|
20
|
+
|
|
21
|
+
private
|
|
22
|
+
|
|
23
|
+
def derive_primary_key: () -> String?
|
|
24
|
+
def derive_foreign_key: () -> String
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
class ActiveRecord::Reflection::BelongsToManyReflection = Torque::PostgreSQL::Reflection::BelongsToManyReflection
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Reflection
|
|
4
|
+
module HasManyReflection
|
|
5
|
+
def connected_through_array?: () -> bool?
|
|
6
|
+
def array_attribute: () -> arel_attribute
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
class ActiveRecord::Reflection::HasManyReflection
|
|
13
|
+
include Torque::PostgreSQL::Reflection::HasManyReflection
|
|
14
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Reflection
|
|
4
|
+
module RuntimeReflection
|
|
5
|
+
def klass: () -> model
|
|
6
|
+
def active_record: () -> model
|
|
7
|
+
def connected_through_array?: () -> bool?
|
|
8
|
+
def macro: () -> Symbol
|
|
9
|
+
def name: () -> Symbol
|
|
10
|
+
def array_attribute: () -> arel_attribute
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
class ActiveRecord::Reflection::RuntimeReflection
|
|
17
|
+
include Torque::PostgreSQL::Reflection::RuntimeReflection
|
|
18
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Reflection
|
|
4
|
+
module ThroughReflection
|
|
5
|
+
def build_id_constraint: (*untyped) -> arel_node
|
|
6
|
+
def connected_through_array?: () -> bool?
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
class ActiveRecord::Reflection::ThroughReflection
|
|
13
|
+
include Torque::PostgreSQL::Reflection::ThroughReflection
|
|
14
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Reflection
|
|
4
|
+
def create: (Symbol macro, Symbol name, Proc? scope, Hash[Symbol, untyped] options, model ar) -> reflection?
|
|
5
|
+
end
|
|
6
|
+
end
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
module ActiveRecord::Reflection
|
|
10
|
+
extend Torque::PostgreSQL::Reflection
|
|
11
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Relation
|
|
4
|
+
module AuxiliaryStatement
|
|
5
|
+
type statement = Symbol | singleton(PostgreSQL::AuxiliaryStatement)
|
|
6
|
+
|
|
7
|
+
def auxiliary_statements_values: () -> Array[PostgreSQL::AuxiliaryStatement]
|
|
8
|
+
def auxiliary_statements_values=: (Array[PostgreSQL::AuxiliaryStatement] value) -> Array[PostgreSQL::AuxiliaryStatement]
|
|
9
|
+
def with: (*statement args, ?recursive: bool, **untyped settings) -> relation
|
|
10
|
+
def with!: (*statement args, ?recursive: bool, **untyped settings) -> self
|
|
11
|
+
alias auxiliary_statements with
|
|
12
|
+
alias auxiliary_statements! with!
|
|
13
|
+
def bound_attributes: () -> Array[untyped]
|
|
14
|
+
|
|
15
|
+
private
|
|
16
|
+
|
|
17
|
+
def build_arel: (*untyped) -> ::Arel::SelectManager
|
|
18
|
+
def instantiate_auxiliary_statements: (*statement args, **untyped options) -> Array[PostgreSQL::AuxiliaryStatement]
|
|
19
|
+
def build_auxiliary_statements: (::Arel::SelectManager arel) -> Array[untyped]?
|
|
20
|
+
def auxiliary_statement_type: () -> (:recursive)?
|
|
21
|
+
def auxiliary_statement_error: (Symbol | String name) -> bot
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
class ActiveRecord::Relation
|
|
28
|
+
include Torque::PostgreSQL::Relation::AuxiliaryStatement
|
|
29
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Relation
|
|
4
|
+
module Buckets
|
|
5
|
+
type keys = Array[untyped] | ::Range[untyped]
|
|
6
|
+
type value = [arel_node, keys, Integer?, column_ref?, column_ref?]
|
|
7
|
+
|
|
8
|
+
def buckets_value: () -> value?
|
|
9
|
+
def buckets_value=: (value? value) -> value?
|
|
10
|
+
def buckets: (column_spec | arel_node attribute, keys values, ?count: Integer?, ?cast: column_ref?, ?as: column_ref?) -> relation
|
|
11
|
+
def buckets!: (column_spec | arel_node attribute, keys values, ?count: Integer?, ?cast: column_ref?, ?as: column_ref?) -> self
|
|
12
|
+
def calculate: (*untyped) -> untyped
|
|
13
|
+
|
|
14
|
+
module Initializer
|
|
15
|
+
def records: () -> (Array[record] | Hash[untyped, Array[record]])
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
private
|
|
19
|
+
|
|
20
|
+
def build_arel: (*untyped) -> ::Arel::SelectManager
|
|
21
|
+
def build_buckets_node: () -> ::Arel::Nodes::NamedFunction
|
|
22
|
+
def buckets_column: () -> String
|
|
23
|
+
def buckets_keys: () -> Array[untyped]
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
module Initializer
|
|
27
|
+
include Buckets::Initializer
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
class ActiveRecord::Relation
|
|
34
|
+
include Torque::PostgreSQL::Relation::Buckets
|
|
35
|
+
end
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Relation
|
|
4
|
+
module CrossJoin
|
|
5
|
+
type row = Hash[column_ref, untyped] | Array[untyped]
|
|
6
|
+
type source = arel_node | relation | ::Arel::SelectManager | Array[row]
|
|
7
|
+
type ordinality = bool | column_ref
|
|
8
|
+
|
|
9
|
+
class Entry < ::Struct[untyped]
|
|
10
|
+
def node: () -> ::Arel::Nodes::Join
|
|
11
|
+
def node=: (::Arel::Nodes::Join value) -> ::Arel::Nodes::Join
|
|
12
|
+
def table: () -> arel_table
|
|
13
|
+
def table=: (arel_table value) -> arel_table
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def self.build: (untyped source, column_ref as, Array[column_ref]? columns, Symbol | String mode, ordinality with_ordinality, ?Hash[column_ref, String?]? definitions) -> Entry
|
|
17
|
+
|
|
18
|
+
private
|
|
19
|
+
|
|
20
|
+
def self.columns_for: (untyped source, Array[column_ref]? columns) -> Array[column_ref]?
|
|
21
|
+
def self.ordinality_for: (ordinality value) -> column_ref?
|
|
22
|
+
def self.validate_ordinality!: (column_ref? ordinality, Array[column_ref]? columns, Hash[column_ref, String?]? definitions) -> nil
|
|
23
|
+
def self.source_for: (untyped source, Array[column_ref]? columns) -> [arel_node, bool]
|
|
24
|
+
def self.unnest_rows: (Array[row] rows, Array[column_ref]? columns) -> ::Arel::Nodes::NamedFunction
|
|
25
|
+
def self.row_values: (row row, Array[Symbol] keys) -> Array[untyped]
|
|
26
|
+
def self.join_for: (Symbol | String mode, Torque::PostgreSQL::Arel::Nodes::FromItem item) -> ::Arel::Nodes::Join
|
|
27
|
+
|
|
28
|
+
public
|
|
29
|
+
|
|
30
|
+
def cross_joins_value: () -> Hash[Symbol, Entry]
|
|
31
|
+
def cross_joins_value=: (Hash[Symbol, Entry] value) -> Hash[Symbol, Entry]
|
|
32
|
+
def cross_join: (untyped source, as: column_ref, ?columns: Array[column_ref]?, ?mode: Symbol | String, ?with_ordinality: ordinality) -> relation
|
|
33
|
+
def cross_join!: (untyped source, as: column_ref, ?columns: Array[column_ref]?, ?mode: Symbol | String, ?with_ordinality: ordinality) -> self
|
|
34
|
+
|
|
35
|
+
private
|
|
36
|
+
|
|
37
|
+
def build_arel: (*untyped) -> ::Arel::SelectManager
|
|
38
|
+
|
|
39
|
+
public
|
|
40
|
+
|
|
41
|
+
module Merger
|
|
42
|
+
def merge: () -> relation
|
|
43
|
+
|
|
44
|
+
private
|
|
45
|
+
|
|
46
|
+
def merge_cross_joins: () -> untyped
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
class ActiveRecord::Relation
|
|
54
|
+
include Torque::PostgreSQL::Relation::CrossJoin
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
class ActiveRecord::Relation::Merger
|
|
58
|
+
prepend Torque::PostgreSQL::Relation::CrossJoin::Merger
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
class ActiveRecord::Base
|
|
62
|
+
def self.cross_join: (untyped source, as: Torque::PostgreSQL::column_ref, ?columns: Array[Torque::PostgreSQL::column_ref]?, ?mode: Symbol | String, ?with_ordinality: Torque::PostgreSQL::Relation::CrossJoin::ordinality) -> ActiveRecord::Relation
|
|
63
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Relation
|
|
4
|
+
module DistinctOn
|
|
5
|
+
def distinct_on_values: () -> Array[column_spec]
|
|
6
|
+
def distinct_on_values=: (Array[column_spec] value) -> Array[column_spec]
|
|
7
|
+
def distinct_on: (*column_spec value) -> relation
|
|
8
|
+
def distinct_on!: (*column_spec value) -> self
|
|
9
|
+
|
|
10
|
+
private
|
|
11
|
+
|
|
12
|
+
def build_arel: (*untyped) -> ::Arel::SelectManager
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Relation
|
|
4
|
+
module Inheritance
|
|
5
|
+
RECORD_CLASS_TOKEN: Symbol
|
|
6
|
+
|
|
7
|
+
def expand_records_values: () -> Array[model]
|
|
8
|
+
def expand_records_values=: (Array[model] value) -> Array[model]
|
|
9
|
+
def expand_records_eager_load_value: () -> bool?
|
|
10
|
+
def expand_records_eager_load_value=: (bool? value) -> bool?
|
|
11
|
+
def expand_records_scoped_value: () -> Hash[model, Array[model]]
|
|
12
|
+
def expand_records_scoped_value=: (Hash[model, Array[model]] value) -> Hash[model, Array[model]]
|
|
13
|
+
def itself_only_value: () -> bool?
|
|
14
|
+
def itself_only_value=: (bool? value) -> bool?
|
|
15
|
+
def quote_table_name: (table_ref name) -> String
|
|
16
|
+
def quote_column_name: (column_ref name) -> String
|
|
17
|
+
def itself_only: () -> relation
|
|
18
|
+
def itself_only!: (*untyped) -> self
|
|
19
|
+
def expand_records: (*model types, ?eager_load: bool, ?filter: bool) -> relation
|
|
20
|
+
def expand_records!: (*model types, ?eager_load: bool, ?filter: bool) -> self
|
|
21
|
+
def select: (*untyped fields) ?{ (?) -> untyped } -> untyped
|
|
22
|
+
|
|
23
|
+
private
|
|
24
|
+
|
|
25
|
+
def raise_itself_only_conflict!: () -> bot
|
|
26
|
+
def build_arel: (*untyped) -> ::Arel::SelectManager
|
|
27
|
+
def inheritance_discriminated?: () -> bool
|
|
28
|
+
def build_record_class_marker: () -> ::Arel::Nodes::As
|
|
29
|
+
def build_inheritances: (::Arel::SelectManager arel) -> untyped
|
|
30
|
+
def build_inheritances_joins: (::Arel::SelectManager arel, Array[model] types) -> Hash[String, Array[::Arel::Nodes::TableAlias]]
|
|
31
|
+
def regclass: () -> Torque::PostgreSQL::Arel::Nodes::Cast
|
|
32
|
+
|
|
33
|
+
public
|
|
34
|
+
|
|
35
|
+
module Expansion
|
|
36
|
+
def preload_associations: (Array[record] records) -> untyped
|
|
37
|
+
|
|
38
|
+
private
|
|
39
|
+
|
|
40
|
+
def exec_queries: () ?{ (record) -> void } -> Array[record]
|
|
41
|
+
def preloaded_association_names: () -> Array[Symbol]
|
|
42
|
+
def warn_about_missing_record_class: (Array[record] records) -> untyped
|
|
43
|
+
def record_class_marker?: (arel_node | column_ref value) -> bool
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Relation
|
|
4
|
+
module JoinSeries
|
|
5
|
+
type step = Numeric | ActiveSupport::Duration | Symbol | String
|
|
6
|
+
type with = column_ref | Hash[column_ref, untyped] | arel_node
|
|
7
|
+
|
|
8
|
+
def self.build: (relation relation, untyped range, ?with: with?, ?as: column_ref, ?step: step?, ?time_zone: untyped, ?cast: column_ref?, ?mode: Symbol) ?{ (Torque::PostgreSQL::Arel::Nodes::Ref series, arel_table table) -> arel_node } -> ::Arel::Nodes::Join
|
|
9
|
+
|
|
10
|
+
private
|
|
11
|
+
|
|
12
|
+
def self.validate_build!: (untyped range, step? step) -> nil
|
|
13
|
+
def self.bind_value: (untyped value) -> arel_node
|
|
14
|
+
def self.arel_join: (Symbol | String mode) -> singleton(::Arel::Nodes::Join)
|
|
15
|
+
def self.build_join_on: (Torque::PostgreSQL::Arel::Nodes::Ref result, relation relation, with? with, column_ref? cast) ?{ (Torque::PostgreSQL::Arel::Nodes::Ref series, arel_table table) -> arel_node } -> arel_node
|
|
16
|
+
|
|
17
|
+
public
|
|
18
|
+
|
|
19
|
+
def join_series: (untyped range, ?with: with?, ?as: column_ref, ?step: step?, ?time_zone: untyped, ?cast: column_ref?, ?mode: Symbol) ?{ (Torque::PostgreSQL::Arel::Nodes::Ref series, arel_table table) -> arel_node } -> relation
|
|
20
|
+
def join_series!: (untyped range, ?with: with?, ?as: column_ref, ?step: step?, ?time_zone: untyped, ?cast: column_ref?, ?mode: Symbol) ?{ (Torque::PostgreSQL::Arel::Nodes::Ref series, arel_table table) -> arel_node } -> self
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
class ActiveRecord::Relation
|
|
27
|
+
include Torque::PostgreSQL::Relation::JoinSeries
|
|
28
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Relation
|
|
4
|
+
module Merger
|
|
5
|
+
def merge: () -> relation
|
|
6
|
+
|
|
7
|
+
private
|
|
8
|
+
|
|
9
|
+
def merge_select_extra: () -> untyped
|
|
10
|
+
def merge_distinct_on: () -> untyped
|
|
11
|
+
def merge_auxiliary_statements: () -> untyped
|
|
12
|
+
def merge_inheritance: () -> untyped
|
|
13
|
+
def raise_eager_load_conflict!: () -> bot
|
|
14
|
+
def merge_buckets: () -> untyped
|
|
15
|
+
def merge_segments: () -> untyped
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
class ActiveRecord::Relation::Merger
|
|
22
|
+
prepend Torque::PostgreSQL::Relation::Merger
|
|
23
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Relation
|
|
4
|
+
module Segments
|
|
5
|
+
type condition = relation | Symbol | Proc | Hash[untyped, untyped] | String | Array[untyped] | arel_node | nil
|
|
6
|
+
|
|
7
|
+
def segments_value: () -> Hash[Symbol, arel_node?]
|
|
8
|
+
def segments_value=: (Hash[Symbol, arel_node?] value) -> Hash[Symbol, arel_node?]
|
|
9
|
+
def segments: (**condition map) -> relation
|
|
10
|
+
def segments!: (**condition map) -> self
|
|
11
|
+
|
|
12
|
+
private
|
|
13
|
+
|
|
14
|
+
def execute_simple_calculation: (String operation, column_spec | arel_node | nil column_name, bool? distinct) -> untyped
|
|
15
|
+
def execute_grouped_calculation: (String operation, column_spec | arel_node | nil column_name, bool? distinct) -> untyped
|
|
16
|
+
def execute_segments_calculation: (String operation, column_spec | arel_node | nil column_name, bool? distinct) -> untyped
|
|
17
|
+
def segments_projections: (Array[arel_node] groups, arel_node aggregate, connection connection) -> Array[::Arel::Nodes::As]
|
|
18
|
+
def segments_result: (ActiveRecord::Result data, Array[arel_node] groups, arel_node column, String operation) -> (Hash[untyped, untyped] | nil)
|
|
19
|
+
def segment_predicate_for: (Symbol name, condition condition) -> arel_node?
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
class ActiveRecord::Relation
|
|
26
|
+
include Torque::PostgreSQL::Relation::Segments
|
|
27
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Relation
|
|
4
|
+
extend ActiveSupport::Concern
|
|
5
|
+
include DistinctOn
|
|
6
|
+
include Inheritance
|
|
7
|
+
|
|
8
|
+
type column_spec = column_ref | Hash[column_ref, untyped] | Array[untyped]
|
|
9
|
+
|
|
10
|
+
SINGLE_VALUE_METHODS: Array[Symbol]
|
|
11
|
+
MULTI_VALUE_METHODS: Array[Symbol]
|
|
12
|
+
VALUE_METHODS: Array[Symbol]
|
|
13
|
+
FROZEN_EMPTY_ARRAY: Array[untyped]
|
|
14
|
+
ARColumn: singleton(ActiveRecord::ConnectionAdapters::PostgreSQL::Column)
|
|
15
|
+
|
|
16
|
+
def select_extra_values: () -> Array[arel_node]
|
|
17
|
+
def select_extra_values=: (Array[arel_node] value) -> Array[arel_node]
|
|
18
|
+
def calculate: (Symbol | String operation, column_spec | nil column_name) -> untyped
|
|
19
|
+
def resolve_column: (column_spec list, ?column_ref | false base) -> Array[arel_node]
|
|
20
|
+
def resolve_base_table: (column_ref | false relation) -> (model | PredicateTable | nil)
|
|
21
|
+
def cast_for_condition: (column_ref | column column, untyped value) -> untyped
|
|
22
|
+
|
|
23
|
+
private
|
|
24
|
+
|
|
25
|
+
def build_arel: (*untyped) -> ::Arel::SelectManager
|
|
26
|
+
def part_table_for: (ActiveRecord::TableMetadata table, String name) -> PredicateTable?
|
|
27
|
+
|
|
28
|
+
public
|
|
29
|
+
|
|
30
|
+
module ClassMethods
|
|
31
|
+
def _record_class_attribute: () -> Symbol
|
|
32
|
+
def _record_class_column_name: () -> String
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
module Initializer
|
|
36
|
+
def initialize: (model klass, *untyped, **untyped) -> void
|
|
37
|
+
def upsert_all: (Array[Hash[column_ref, untyped]] attributes, ?where: String | relation | nil, **untyped xargs) -> untyped
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
class ActiveRecord::Relation
|
|
44
|
+
include Torque::PostgreSQL::Relation
|
|
45
|
+
extend Torque::PostgreSQL::Relation::ClassMethods
|
|
46
|
+
prepend Torque::PostgreSQL::Relation::Initializer
|
|
47
|
+
prepend Torque::PostgreSQL::Relation::Inheritance::Expansion
|
|
48
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module BoundSchemaReflection
|
|
4
|
+
def add_model_name: (String table_name, model model) -> model?
|
|
5
|
+
def dependencies: (String table_name) -> Array[String]?
|
|
6
|
+
def associations: (String table_name) -> Array[String]?
|
|
7
|
+
def lookup_model: (String table_name, ?String | model scoped_class) -> model
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
class ActiveRecord::ConnectionAdapters::BoundSchemaReflection
|
|
13
|
+
prepend Torque::PostgreSQL::BoundSchemaReflection
|
|
14
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module SchemaCache
|
|
4
|
+
module Inheritance
|
|
5
|
+
def lookup_model: (String table_name, ?String | model scoped_class, source_to_model: Hash[String, model]) -> model
|
|
6
|
+
def find_model: (String | Array[String] max_name, String table_name, ?Module scope) -> model?
|
|
7
|
+
def generate_associations: (Hash[String, Array[String]] inheritance_dependencies) -> Hash[String, Array[String]]
|
|
8
|
+
def prepare_irregular_models: (Array[String] data_sources) -> Hash[String, model]
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module SchemaReflection
|
|
4
|
+
def add_model_name: (SchemaCache::source source, String table_name, model model) -> model?
|
|
5
|
+
def dependencies: (SchemaCache::source source, String table_name) -> Array[String]?
|
|
6
|
+
def associations: (SchemaCache::source source, String table_name) -> Array[String]?
|
|
7
|
+
def lookup_model: (SchemaCache::source source, String table_name, String | model scoped_class) -> model
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
class ActiveRecord::ConnectionAdapters::SchemaReflection
|
|
13
|
+
prepend Torque::PostgreSQL::SchemaReflection
|
|
14
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
class LookupError < ArgumentError
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
# initialize is not declared: schema_cache/inheritance.rb reopens this
|
|
7
|
+
# module before it is defined, and the runtime checker hooks it eagerly
|
|
8
|
+
module SchemaCache
|
|
9
|
+
include SchemaCache::Inheritance
|
|
10
|
+
|
|
11
|
+
type source = connection | pool
|
|
12
|
+
|
|
13
|
+
@data_sources_model_names: Hash[String, model]
|
|
14
|
+
@inheritance_dependencies: Hash[String, Array[String]]
|
|
15
|
+
@inheritance_associations: Hash[String, Array[String]]
|
|
16
|
+
@inheritance_loaded: bool
|
|
17
|
+
|
|
18
|
+
def initialize_dup: (*untyped) -> untyped
|
|
19
|
+
def encode_with: (untyped coder) -> untyped
|
|
20
|
+
def init_with: (untyped coder) -> untyped
|
|
21
|
+
def add: (source | String connection_or_table_name, ?String table_name, *untyped) -> untyped
|
|
22
|
+
def clear!: () -> untyped
|
|
23
|
+
def size: () -> Integer
|
|
24
|
+
def clear_data_source_cache!: (source | String connection_or_name, ?String name) -> untyped
|
|
25
|
+
def marshal_dump: () -> Array[untyped]
|
|
26
|
+
def marshal_load: (Array[untyped] array) -> untyped
|
|
27
|
+
def add_model_name: (*untyped args) -> model?
|
|
28
|
+
def dependencies: (source | String source, ?String table_name) -> Array[String]?
|
|
29
|
+
def associations: (source | String source, ?String table_name) -> Array[String]?
|
|
30
|
+
def lookup_model: (String table_name, ?String | model scoped_class) -> model
|
|
31
|
+
|
|
32
|
+
private
|
|
33
|
+
|
|
34
|
+
def reload_inheritance_data!: (source source) -> untyped
|
|
35
|
+
def generate_associations: () -> Hash[String, Array[String]]
|
|
36
|
+
def add_all: (?source? source) -> untyped
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
class ActiveRecord::ConnectionAdapters::SchemaCache
|
|
42
|
+
prepend Torque::PostgreSQL::SchemaCache
|
|
43
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
class TableName < Delegator
|
|
4
|
+
@klass: model
|
|
5
|
+
@table_name: String
|
|
6
|
+
@schema: String?
|
|
7
|
+
|
|
8
|
+
def initialize: (model klass, String table_name) -> void
|
|
9
|
+
def schema: () -> String?
|
|
10
|
+
def to_s: () -> String
|
|
11
|
+
alias __getobj__ to_s
|
|
12
|
+
def ==: (untyped other) -> Integer?
|
|
13
|
+
def __setobj__: (String value) -> String
|
|
14
|
+
|
|
15
|
+
private
|
|
16
|
+
|
|
17
|
+
def search_path_schemes: () -> Array[String]
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Validations
|
|
4
|
+
class NestedValidator < ActiveModel::EachValidator
|
|
5
|
+
def validate_each: (ActiveModel::Validations record, column_ref attribute, untyped value) -> untyped
|
|
6
|
+
end
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
class ActiveRecord::Base
|
|
12
|
+
include Torque::PostgreSQL::Validations
|
|
13
|
+
end
|