torque-postgresql 4.1.0 → 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.
Files changed (194) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +28 -0
  3. data/lib/generators/torque/skill_generator.rb +17 -0
  4. data/lib/generators/torque/templates/trigger.sql.erb +3 -0
  5. data/lib/generators/torque/trigger_generator.rb +13 -0
  6. data/lib/torque/postgresql/adapter/database_statements.rb +9 -0
  7. data/lib/torque/postgresql/adapter/oid/array.rb +0 -4
  8. data/lib/torque/postgresql/adapter/oid/composite.rb +2 -1
  9. data/lib/torque/postgresql/adapter/oid/enum.rb +1 -1
  10. data/lib/torque/postgresql/adapter/oid/enum_set.rb +2 -2
  11. data/lib/torque/postgresql/adapter/oid/interval.rb +1 -1
  12. data/lib/torque/postgresql/adapter/oid/lquery.rb +45 -28
  13. data/lib/torque/postgresql/adapter/oid/ltree.rb +67 -9
  14. data/lib/torque/postgresql/adapter/oid/struct.rb +1 -1
  15. data/lib/torque/postgresql/adapter/oid.rb +13 -0
  16. data/lib/torque/postgresql/adapter/schema_definitions.rb +5 -0
  17. data/lib/torque/postgresql/adapter/schema_dumper.rb +1 -0
  18. data/lib/torque/postgresql/arel/nodes.rb +51 -0
  19. data/lib/torque/postgresql/arel/visitors.rb +46 -0
  20. data/lib/torque/postgresql/attributes/base.rb +10 -7
  21. data/lib/torque/postgresql/attributes/composite.rb +1 -5
  22. data/lib/torque/postgresql/attributes/enum.rb +1 -6
  23. data/lib/torque/postgresql/attributes/lquery.rb +67 -127
  24. data/lib/torque/postgresql/attributes/ltree.rb +35 -83
  25. data/lib/torque/postgresql/base.rb +9 -1
  26. data/lib/torque/postgresql/config.rb +21 -3
  27. data/lib/torque/postgresql/geometry_builder.rb +4 -10
  28. data/lib/torque/postgresql/inheritance.rb +5 -5
  29. data/lib/torque/postgresql/predicate_builder/arel_attribute_handler.rb +1 -1
  30. data/lib/torque/postgresql/predicate_builder/array_handler.rb +16 -8
  31. data/lib/torque/postgresql/predicate_builder/composite_handler.rb +18 -5
  32. data/lib/torque/postgresql/predicate_builder/ltree_handler.rb +86 -18
  33. data/lib/torque/postgresql/predicate_builder/struct_handler.rb +29 -9
  34. data/lib/torque/postgresql/predicate_builder.rb +38 -11
  35. data/lib/torque/postgresql/railtie.rb +17 -0
  36. data/lib/torque/postgresql/relation/auxiliary_statement.rb +7 -3
  37. data/lib/torque/postgresql/relation/buckets.rb +2 -1
  38. data/lib/torque/postgresql/relation/cross_join.rb +193 -0
  39. data/lib/torque/postgresql/relation/inheritance.rb +1 -2
  40. data/lib/torque/postgresql/relation/join_series.rb +1 -0
  41. data/lib/torque/postgresql/relation/merger.rb +9 -0
  42. data/lib/torque/postgresql/relation/segments.rb +140 -0
  43. data/lib/torque/postgresql/relation.rb +23 -4
  44. data/lib/torque/postgresql/version.rb +1 -1
  45. data/lib/torque/postgresql/versioned_commands/command_migration.rb +23 -0
  46. data/lib/torque/postgresql/versioned_commands.rb +39 -0
  47. data/lib/torque/postgresql.rb +0 -2
  48. data/sig/generators/torque/function_generator.rbs +9 -0
  49. data/sig/generators/torque/skill_generator.rbs +7 -0
  50. data/sig/generators/torque/trigger_generator.rbs +9 -0
  51. data/sig/generators/torque/type_generator.rbs +9 -0
  52. data/sig/generators/torque/view_generator.rbs +9 -0
  53. data/sig/manifest.yaml +7 -0
  54. data/sig/torque/postgresql/adapter/database_statements.rbs +42 -0
  55. data/sig/torque/postgresql/adapter/inheritance_statements.rbs +36 -0
  56. data/sig/torque/postgresql/adapter/oid/array.rbs +20 -0
  57. data/sig/torque/postgresql/adapter/oid/box.rbs +28 -0
  58. data/sig/torque/postgresql/adapter/oid/circle.rbs +33 -0
  59. data/sig/torque/postgresql/adapter/oid/composite.rbs +35 -0
  60. data/sig/torque/postgresql/adapter/oid/enum.rbs +28 -0
  61. data/sig/torque/postgresql/adapter/oid/enum_set.rbs +19 -0
  62. data/sig/torque/postgresql/adapter/oid/interval.rbs +20 -0
  63. data/sig/torque/postgresql/adapter/oid/line.rbs +33 -0
  64. data/sig/torque/postgresql/adapter/oid/lquery.rbs +21 -0
  65. data/sig/torque/postgresql/adapter/oid/ltree.rbs +32 -0
  66. data/sig/torque/postgresql/adapter/oid/range.rbs +28 -0
  67. data/sig/torque/postgresql/adapter/oid/segment.rbs +38 -0
  68. data/sig/torque/postgresql/adapter/oid/struct.rbs +41 -0
  69. data/sig/torque/postgresql/adapter/oid/struct_list.rbs +20 -0
  70. data/sig/torque/postgresql/adapter/oid/struct_set.rbs +18 -0
  71. data/sig/torque/postgresql/adapter/oid.rbs +9 -0
  72. data/sig/torque/postgresql/adapter/quoting.rbs +20 -0
  73. data/sig/torque/postgresql/adapter/schema_creation.rbs +13 -0
  74. data/sig/torque/postgresql/adapter/schema_definitions.rbs +55 -0
  75. data/sig/torque/postgresql/adapter/schema_dumper.rbs +37 -0
  76. data/sig/torque/postgresql/adapter/schema_overrides.rbs +46 -0
  77. data/sig/torque/postgresql/adapter/schema_statements.rbs +50 -0
  78. data/sig/torque/postgresql/adapter.rbs +24 -0
  79. data/sig/torque/postgresql/arel/infix_operation.rbs +79 -0
  80. data/sig/torque/postgresql/arel/join_source.rbs +19 -0
  81. data/sig/torque/postgresql/arel/nodes.rbs +83 -0
  82. data/sig/torque/postgresql/arel/operations.rbs +28 -0
  83. data/sig/torque/postgresql/arel/select_manager.rbs +15 -0
  84. data/sig/torque/postgresql/arel/visitors.rbs +30 -0
  85. data/sig/torque/postgresql/arel.rbs +6 -0
  86. data/sig/torque/postgresql/associations/association_scope.rbs +28 -0
  87. data/sig/torque/postgresql/associations/belongs_to_many_association.rbs +51 -0
  88. data/sig/torque/postgresql/associations/builder/belongs_to_many.rbs +24 -0
  89. data/sig/torque/postgresql/associations/builder/has_many.rbs +15 -0
  90. data/sig/torque/postgresql/associations/builder.rbs +8 -0
  91. data/sig/torque/postgresql/associations/foreign_association.rbs +16 -0
  92. data/sig/torque/postgresql/associations/join_dependency.rbs +16 -0
  93. data/sig/torque/postgresql/associations/preloader/association.rbs +32 -0
  94. data/sig/torque/postgresql/associations/preloader/loader_query.rbs +20 -0
  95. data/sig/torque/postgresql/associations/preloader.rbs +8 -0
  96. data/sig/torque/postgresql/associations.rbs +17 -0
  97. data/sig/torque/postgresql/attributes/base.rbs +37 -0
  98. data/sig/torque/postgresql/attributes/builder/enum.rbs +38 -0
  99. data/sig/torque/postgresql/attributes/builder/full_text_search.rbs +27 -0
  100. data/sig/torque/postgresql/attributes/builder/period.rbs +106 -0
  101. data/sig/torque/postgresql/attributes/builder.rbs +19 -0
  102. data/sig/torque/postgresql/attributes/composite.rbs +28 -0
  103. data/sig/torque/postgresql/attributes/enum.rbs +69 -0
  104. data/sig/torque/postgresql/attributes/enum_set.rbs +75 -0
  105. data/sig/torque/postgresql/attributes/full_text_search.rbs +13 -0
  106. data/sig/torque/postgresql/attributes/lazy.rbs +17 -0
  107. data/sig/torque/postgresql/attributes/lquery.rbs +48 -0
  108. data/sig/torque/postgresql/attributes/ltree.rbs +46 -0
  109. data/sig/torque/postgresql/attributes/period.rbs +13 -0
  110. data/sig/torque/postgresql/attributes/simple_enum.rbs +39 -0
  111. data/sig/torque/postgresql/attributes/struct.rbs +38 -0
  112. data/sig/torque/postgresql/attributes.rbs +6 -0
  113. data/sig/torque/postgresql/autosave_association.rbs +16 -0
  114. data/sig/torque/postgresql/auxiliary_statement/recursive.rbs +22 -0
  115. data/sig/torque/postgresql/auxiliary_statement/settings.rbs +63 -0
  116. data/sig/torque/postgresql/auxiliary_statement.rbs +57 -0
  117. data/sig/torque/postgresql/base.rbs +41 -0
  118. data/sig/torque/postgresql/collector.rbs +7 -0
  119. data/sig/torque/postgresql/config.rbs +9 -0
  120. data/sig/torque/postgresql/function.rbs +21 -0
  121. data/sig/torque/postgresql/geometry_builder.rbs +20 -0
  122. data/sig/torque/postgresql/i18n.rbs +15 -0
  123. data/sig/torque/postgresql/inheritance/expander.rbs +23 -0
  124. data/sig/torque/postgresql/inheritance/record.rbs +20 -0
  125. data/sig/torque/postgresql/inheritance.rbs +47 -0
  126. data/sig/torque/postgresql/insert_all.rbs +22 -0
  127. data/sig/torque/postgresql/migration/command_recorder.rbs +30 -0
  128. data/sig/torque/postgresql/migration.rbs +6 -0
  129. data/sig/torque/postgresql/predicate_builder/arel_attribute_handler.rbs +15 -0
  130. data/sig/torque/postgresql/predicate_builder/array_handler.rbs +26 -0
  131. data/sig/torque/postgresql/predicate_builder/composite_handler.rbs +26 -0
  132. data/sig/torque/postgresql/predicate_builder/enumerator_lazy_handler.rbs +18 -0
  133. data/sig/torque/postgresql/predicate_builder/ltree_handler.rbs +36 -0
  134. data/sig/torque/postgresql/predicate_builder/regexp_handler.rbs +16 -0
  135. data/sig/torque/postgresql/predicate_builder/struct_handler.rbs +24 -0
  136. data/sig/torque/postgresql/predicate_builder.rbs +23 -0
  137. data/sig/torque/postgresql/predicate_table.rbs +24 -0
  138. data/sig/torque/postgresql/railtie.rbs +10 -0
  139. data/sig/torque/postgresql/reflection/abstract_reflection.rbs +22 -0
  140. data/sig/torque/postgresql/reflection/association_reflection.rbs +18 -0
  141. data/sig/torque/postgresql/reflection/belongs_to_many_reflection.rbs +30 -0
  142. data/sig/torque/postgresql/reflection/has_many_reflection.rbs +14 -0
  143. data/sig/torque/postgresql/reflection/runtime_reflection.rbs +18 -0
  144. data/sig/torque/postgresql/reflection/through_reflection.rbs +14 -0
  145. data/sig/torque/postgresql/reflection.rbs +11 -0
  146. data/sig/torque/postgresql/relation/auxiliary_statement.rbs +29 -0
  147. data/sig/torque/postgresql/relation/buckets.rbs +35 -0
  148. data/sig/torque/postgresql/relation/cross_join.rbs +63 -0
  149. data/sig/torque/postgresql/relation/distinct_on.rbs +16 -0
  150. data/sig/torque/postgresql/relation/inheritance.rbs +48 -0
  151. data/sig/torque/postgresql/relation/join_series.rbs +28 -0
  152. data/sig/torque/postgresql/relation/merger.rbs +23 -0
  153. data/sig/torque/postgresql/relation/segments.rbs +27 -0
  154. data/sig/torque/postgresql/relation.rbs +48 -0
  155. data/sig/torque/postgresql/schema_cache/bound_schema_reflection.rbs +14 -0
  156. data/sig/torque/postgresql/schema_cache/inheritance.rbs +12 -0
  157. data/sig/torque/postgresql/schema_cache/schema_reflection.rbs +14 -0
  158. data/sig/torque/postgresql/schema_cache.rbs +43 -0
  159. data/sig/torque/postgresql/table_name.rbs +20 -0
  160. data/sig/torque/postgresql/validations.rbs +13 -0
  161. data/sig/torque/postgresql/version.rbs +5 -0
  162. data/sig/torque/postgresql/versioned_commands/command_migration.rbs +54 -0
  163. data/sig/torque/postgresql/versioned_commands/generator.rbs +17 -0
  164. data/sig/torque/postgresql/versioned_commands/migration_context.rbs +30 -0
  165. data/sig/torque/postgresql/versioned_commands/migrator.rbs +19 -0
  166. data/sig/torque/postgresql/versioned_commands/schema_table.rbs +23 -0
  167. data/sig/torque/postgresql/versioned_commands.rbs +25 -0
  168. data/sig/torque/postgresql.rbs +26 -0
  169. data/skills/torque-postgresql/SKILL.md +70 -0
  170. data/spec/fixtures/migrations/20250101000008_create_trigger_audit_users_v1.sql +3 -0
  171. data/spec/initialize.rb +9 -0
  172. data/spec/mocks/cache_query.rb +1 -1
  173. data/spec/rbs_helper.rb +8 -0
  174. data/spec/schema.rb +2 -0
  175. data/spec/spec_helper.rb +1 -0
  176. data/spec/tests/arel_spec.rb +1 -3
  177. data/spec/tests/auxiliary_statement_spec.rb +12 -0
  178. data/spec/tests/buckets_spec.rb +122 -0
  179. data/spec/tests/composite_spec.rb +67 -0
  180. data/spec/tests/cross_join_spec.rb +185 -0
  181. data/spec/tests/distinct_on_spec.rb +5 -0
  182. data/spec/tests/enum_set_spec.rb +4 -0
  183. data/spec/tests/enum_spec.rb +20 -4
  184. data/spec/tests/geometric_builder_spec.rb +16 -5
  185. data/spec/tests/has_many_spec.rb +2 -1
  186. data/spec/tests/interval_spec.rb +6 -0
  187. data/spec/tests/ltree_spec.rb +398 -64
  188. data/spec/tests/predicate_builder_spec.rb +120 -0
  189. data/spec/tests/relation_spec.rb +25 -69
  190. data/spec/tests/segments_spec.rb +264 -0
  191. data/spec/tests/struct_spec.rb +202 -0
  192. data/spec/tests/table_inheritance_spec.rb +10 -0
  193. data/spec/tests/versioned_commands_spec.rb +145 -0
  194. metadata +153 -2
@@ -0,0 +1,75 @@
1
+ module Torque
2
+ module PostgreSQL
3
+ module Attributes
4
+ class EnumSet < Set[untyped]
5
+ include Comparable
6
+ extend Enumerable[untyped]
7
+
8
+ class EnumSetError < Enum::EnumError
9
+ end
10
+
11
+ @type_name: String
12
+ @hash: Hash[Enum, bool]
13
+
14
+ def self.each: (*untyped) ?{ (Enum) -> untyped } -> untyped
15
+ def self.values: () -> Array[String]?
16
+ def self.keys: () -> Array[Symbol]
17
+ def self.members: () -> Array[Enum]
18
+ def self.texts: () -> Array[String]
19
+ def self.to_options: () -> Array[[String, String]]
20
+ def self.valid?: (untyped value) -> bool
21
+ def self.size: () -> Integer
22
+ def self.length: () -> Integer
23
+ def self.connection_specification_name: (*untyped) -> untyped
24
+ def self.lookup: (table_ref name, singleton(Enum) enum_klass) -> singleton(EnumSet)
25
+ def self.include_on: (model klass, ?Symbol? method_name) -> untyped
26
+ def self.enum_source: () -> singleton(Enum)
27
+ def self.sample: () -> untyped
28
+ def self.new: (*untyped values) -> untyped
29
+ def self.type_name: () -> String
30
+ def self.fetch: (String | Symbol value, *untyped) -> untyped
31
+ alias self.[] self.fetch
32
+ def self.power: (*untyped values) -> Integer?
33
+ def self.scope: (arel_attribute attribute, untyped value) -> ::Arel::Nodes::InfixOperation
34
+
35
+ private
36
+
37
+ def self.respond_to_missing?: (Symbol method_name, ?bool include_private) -> bool
38
+ def self.method_missing: (Symbol method_name, *untyped arguments) -> untyped
39
+
40
+ public
41
+
42
+ def initialize: (*untyped values) -> void
43
+ def <=>: (untyped other) -> Integer?
44
+ def ==: (untyped other) -> bool
45
+ alias eql? ==
46
+ def replace: (*untyped values) -> self
47
+ def text: (?column_ref? attr, ?untyped model) -> String
48
+ alias to_s text
49
+ def to_i: () -> Integer?
50
+ def inspect: () -> String
51
+ def []=: (untyped key, untyped value) -> untyped
52
+ def merge: (Enumerable[untyped] other) -> self
53
+ def &: (Enumerable[untyped] other) -> untyped
54
+ def add: (untyped other) -> self
55
+ def delete: (untyped other) -> self
56
+ def include?: (untyped other) -> bool?
57
+ def subtract: (untyped other) -> self
58
+
59
+ private
60
+
61
+ def instantiate: (untyped value) -> untyped
62
+ def transform_power: (Integer value) -> Array[Enum]
63
+ def transform_values: (Array[untyped] values) -> Array[Enum]
64
+ def respond_to_missing?: (Symbol method_name, ?bool include_private) -> untyped
65
+ def method_missing: (Symbol method_name, *untyped arguments) -> untyped
66
+ def raise_invalid: (untyped value) -> bot
67
+ def raise_comparison: (untyped other) -> bot
68
+ end
69
+ end
70
+ end
71
+ end
72
+
73
+ class ActiveRecord::Base
74
+ def self.torque_enum_set: (*Torque::PostgreSQL::column_ref attributes, ?only: Array[Torque::PostgreSQL::column_ref] | Torque::PostgreSQL::column_ref, ?except: Array[Torque::PostgreSQL::column_ref] | Torque::PostgreSQL::column_ref, ?prefix: bool | Torque::PostgreSQL::column_ref, ?suffix: bool | Torque::PostgreSQL::column_ref, ?force: bool) -> untyped
75
+ end
@@ -0,0 +1,13 @@
1
+ module Torque
2
+ module PostgreSQL
3
+ module Attributes
4
+ module FullTextSearch
5
+ def self.include_on: (model klass, ?Symbol? method_name) -> untyped
6
+ end
7
+ end
8
+ end
9
+ end
10
+
11
+ class ActiveRecord::Base
12
+ def self.torque_search_for: (*Torque::PostgreSQL::column_ref attributes, ?with_rank: bool | Torque::PostgreSQL::column_ref, ?mode: Symbol, ?order: bool | Symbol, ?language: String | Symbol, ?prefix: Torque::PostgreSQL::column_ref, ?suffix: Torque::PostgreSQL::column_ref, ?force: bool) -> untyped
13
+ end
@@ -0,0 +1,17 @@
1
+ module Torque
2
+ module PostgreSQL
3
+ module Attributes
4
+ class Lazy < BasicObject
5
+ @klass: Class
6
+ @values: ::Array[untyped]
7
+
8
+ def initialize: (Class klass, *untyped values) -> void
9
+ def ==: (untyped other) -> bool
10
+ def nil?: () -> true
11
+ def inspect: () -> String
12
+ def __class__: () -> singleton(Lazy)
13
+ def method_missing: (Symbol name, *untyped args) ?{ (?) -> untyped } -> untyped
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,48 @@
1
+ module Torque
2
+ module PostgreSQL
3
+ module Attributes
4
+ class LQuery
5
+ include Enumerable[untyped]
6
+
7
+ MARKERS: Regexp
8
+ LEVEL: Regexp
9
+ VARIANT: Regexp
10
+
11
+ attr_reader items: Array[untyped]
12
+
13
+ @pattern: Regexp
14
+
15
+ def inspect: () -> String
16
+ def each: (*untyped) ?{ (untyped) -> untyped } -> untyped
17
+ def size: () -> Integer
18
+ def empty?: () -> bool
19
+ def []: (*untyped) -> untyped
20
+
21
+ def self.[]: (*untyped items) -> instance
22
+
23
+ def initialize: (?untyped value, ?sanitize: bool) -> void
24
+ def to_s: () -> String
25
+ def pattern?: () -> bool
26
+ def pattern: () -> Regexp
27
+ def match?: (LTree | untyped path) -> bool
28
+ def =~: (LTree | untyped path) -> Integer?
29
+ def ==: (untyped other) -> bool
30
+ alias eql? ==
31
+ def hash: () -> Integer
32
+
33
+ private
34
+
35
+ def type: () -> Adapter::OID::Lquery
36
+ def compile: () -> Regexp
37
+ def compile_level: (String text) -> String
38
+ def compile_variants: (Array[String] variants) -> String
39
+ def compile_variant: (String text) -> String
40
+ def label: (String name, bool prefix) -> String
41
+ def words: (String name, bool prefix) -> String
42
+ def quantifier: (MatchData match) -> String
43
+ end
44
+ end
45
+
46
+ class LQuery = Attributes::LQuery
47
+ end
48
+ end
@@ -0,0 +1,46 @@
1
+ module Torque
2
+ module PostgreSQL
3
+ module Attributes
4
+ class LTree
5
+ include Enumerable[untyped]
6
+
7
+ attr_reader items: Array[untyped]
8
+
9
+ def inspect: () -> String
10
+ def each: (*untyped) ?{ (untyped) -> untyped } -> untyped
11
+ def size: () -> Integer
12
+ def empty?: () -> bool
13
+ def []: (*untyped) -> untyped
14
+ alias depth size
15
+
16
+ def self.[]: (*untyped items) -> instance
17
+ def self.compatible?: (untyped value) -> bool
18
+ def self.compatible: (untyped value) -> untyped
19
+
20
+ def initialize: (?untyped value, ?sanitize: bool) -> void
21
+ def to_s: () -> String
22
+ def ==: (untyped other) -> bool
23
+ alias eql? ==
24
+ def hash: () -> Integer
25
+ def root?: () -> bool
26
+ def root: () -> instance
27
+ def parent: () -> instance?
28
+ def /: (untyped other) -> instance
29
+ alias + /
30
+ def ancestor_of?: (untyped other) -> bool
31
+ alias covers? ancestor_of?
32
+ def descendant_of?: (untyped other) -> bool
33
+ alias covered_by? descendant_of?
34
+ def lca: (*untyped others) -> instance
35
+ def index_of: (untyped subpath, ?Integer offset) -> Integer
36
+
37
+ private
38
+
39
+ def type: () -> Adapter::OID::Ltree
40
+ def common_prefix: (Array[untyped] one, Array[untyped] other) -> Array[untyped]
41
+ end
42
+ end
43
+
44
+ class LTree = Attributes::LTree
45
+ end
46
+ end
@@ -0,0 +1,13 @@
1
+ module Torque
2
+ module PostgreSQL
3
+ module Attributes
4
+ module Period
5
+ def self.include_on: (model klass, ?Symbol? method_name) -> untyped
6
+ end
7
+ end
8
+ end
9
+ end
10
+
11
+ class ActiveRecord::Base
12
+ def self.period_for: (*Torque::PostgreSQL::column_ref attributes, ?pessimistic: bool, ?threshold: bool | Torque::PostgreSQL::column_ref | ActiveSupport::Duration | Numeric, ?methods: Hash[Symbol, Torque::PostgreSQL::column_ref], ?prefixed: bool, ?force: bool) -> untyped
13
+ end
@@ -0,0 +1,39 @@
1
+ module Torque
2
+ module PostgreSQL
3
+ module Attributes
4
+ module SimpleEnum
5
+ extend ActiveSupport::Concern
6
+
7
+ type values = Hash[column_ref, untyped] | Array[untyped] | nil
8
+
9
+ class Methods < Module
10
+ @klass: singleton(Base)
11
+
12
+ def initialize: (singleton(Base) klass) -> void
13
+
14
+ private
15
+
16
+ def klass: () -> singleton(Base)
17
+ def define_enum_methods: (column_ref name, String value_method_name, untyped value, untyped _scopes, bool instance_methods) -> Symbol?
18
+ end
19
+
20
+ def defined_enums: () -> Hash[String, type_caster]
21
+
22
+ module ClassMethods
23
+ include ActiveRecord::Enum
24
+
25
+ @_enum_methods_module: Methods
26
+
27
+ def defined_enums: () -> Hash[String, type_caster]
28
+ def defined_enums=: (Hash[String, type_caster] value) -> Hash[String, type_caster]
29
+ def enum: (column_ref name, ?values values, ?prefix: bool | column_ref, ?suffix: bool | column_ref, ?default: untyped, ?validate: bool | Hash[Symbol, untyped], ?instance_methods: bool, **untyped options) -> untyped
30
+
31
+ private
32
+
33
+ def _enum_methods_module: () -> Methods
34
+ def detect_enum_conflict!: (column_ref enum_name, String | Symbol method_name, ?bool klass_method) -> nil
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -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,6 @@
1
+ module Torque
2
+ module PostgreSQL
3
+ module Attributes
4
+ end
5
+ end
6
+ 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,7 @@
1
+ module Torque
2
+ module PostgreSQL
3
+ module Collector
4
+ def self.new: (*Symbol | Array[Symbol] args) -> Class
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,9 @@
1
+ module Torque
2
+ module PostgreSQL
3
+ AR810: bool
4
+
5
+ def self.config: () -> ActiveSupport::InheritableOptions
6
+ def self.configure: () { (ActiveSupport::InheritableOptions config) -> void } -> void
7
+ def self.logger: () -> untyped
8
+ end
9
+ 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