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
data/lib/torque/postgresql.rb
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
require 'i18n'
|
|
2
2
|
require 'ostruct'
|
|
3
|
+
require 'monitor'
|
|
3
4
|
require 'active_model'
|
|
4
5
|
require 'active_record'
|
|
5
6
|
require 'active_support'
|
|
6
7
|
|
|
8
|
+
require 'active_support/ordered_options'
|
|
7
9
|
require 'active_support/core_ext/date/acts_like'
|
|
8
10
|
require 'active_support/core_ext/time/zones'
|
|
9
11
|
require 'active_record/connection_adapters/postgresql_adapter'
|
|
@@ -12,6 +14,7 @@ require 'torque/postgresql/config'
|
|
|
12
14
|
require 'torque/postgresql/version'
|
|
13
15
|
require 'torque/postgresql/collector'
|
|
14
16
|
require 'torque/postgresql/geometry_builder'
|
|
17
|
+
require 'torque/postgresql/predicate_table'
|
|
15
18
|
require 'torque/postgresql/predicate_builder'
|
|
16
19
|
|
|
17
20
|
require 'torque/postgresql/i18n'
|
|
@@ -29,5 +32,6 @@ require 'torque/postgresql/reflection'
|
|
|
29
32
|
require 'torque/postgresql/schema_cache'
|
|
30
33
|
require 'torque/postgresql/table_name'
|
|
31
34
|
require 'torque/postgresql/function'
|
|
35
|
+
require 'torque/postgresql/validations'
|
|
32
36
|
|
|
33
37
|
require 'torque/postgresql/railtie' if defined?(Rails)
|
data/sig/manifest.yaml
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Adapter
|
|
4
|
+
module DatabaseStatements
|
|
5
|
+
EXTENDED_DATABASE_TYPES: Array[Symbol]
|
|
6
|
+
|
|
7
|
+
@_dump_mode: bool
|
|
8
|
+
@schemas_blacklist: Array[String]
|
|
9
|
+
@schemas_whitelist: Array[String]
|
|
10
|
+
@schemas_search_path_sanitized: Array[String]
|
|
11
|
+
|
|
12
|
+
def dump_mode!: () -> bool
|
|
13
|
+
def schemas_blacklist: () -> Array[String]
|
|
14
|
+
def schemas_whitelist: () -> Array[String]
|
|
15
|
+
def schemas_search_path_sanitized: () -> Array[String]
|
|
16
|
+
def valid_type?: (Symbol | String type) -> bool
|
|
17
|
+
def extended_types: () -> Array[Symbol]
|
|
18
|
+
def schema_exists?: (table_ref name, ?filtered: bool) -> bool
|
|
19
|
+
def type_exists?: (table_ref name) -> bool
|
|
20
|
+
alias data_type_exists? type_exists?
|
|
21
|
+
def initialize_type_map: (?untyped m) -> untyped
|
|
22
|
+
def load_additional_types: (?Array[Integer]? oids) -> untyped
|
|
23
|
+
def torque_load_additional_types: (?Array[Integer]? oids) -> untyped
|
|
24
|
+
def torque_load_additional_types?: () -> bool
|
|
25
|
+
def composite_column_types: (table_ref name) -> Hash[String, type_caster]
|
|
26
|
+
def composite_types: () -> Array[String]
|
|
27
|
+
def user_defined_types: (*String? categories) -> Hash[String, String]
|
|
28
|
+
def inherited_tables: () -> Hash[String, Array[String]]
|
|
29
|
+
def user_defined_schemas: () -> Array[String]
|
|
30
|
+
def user_defined_schemas_sql: () -> String
|
|
31
|
+
def column_definitions: (table_ref table_name) -> Array[Array[untyped]]
|
|
32
|
+
def list_versioned_commands: (Symbol type) -> Array[[String, String]]
|
|
33
|
+
def filter_by_schema: () -> Array[String]
|
|
34
|
+
|
|
35
|
+
private
|
|
36
|
+
|
|
37
|
+
def composite_type_dependencies: () -> Hash[String, Array[String]]
|
|
38
|
+
def sort_composite_type: (String name, Hash[String, Array[String]] dependencies, Array[String] result) -> Array[String]?
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Adapter
|
|
4
|
+
module InheritanceStatements
|
|
5
|
+
type features = Hash[Symbol, bool]
|
|
6
|
+
type tree = Array[[String, Array[String]]]
|
|
7
|
+
|
|
8
|
+
SYNC_MARKER: String
|
|
9
|
+
SYNC_FEATURES: Array[Symbol]
|
|
10
|
+
|
|
11
|
+
def sync_inheritance_features: (table_ref table_name, ?table_ref | Array[table_ref] | nil children, ?prune: bool, **bool features) -> tree
|
|
12
|
+
|
|
13
|
+
private
|
|
14
|
+
|
|
15
|
+
def sync_inheritance_tree: (table_ref table_name, table_ref | Array[table_ref] | nil children) -> tree
|
|
16
|
+
def sync_inheritance_descendants: (Hash[String, Array[String]] dependencies, String table_name) -> Array[String]
|
|
17
|
+
def sync_inheritance_selection: (Hash[Symbol, bool] | bool features) -> features
|
|
18
|
+
def sync_inheritance_into: (String child, Array[String] parents, features features, bool prune) -> untyped
|
|
19
|
+
def sync_inheritance_primary_key: (String child, Array[String] parents) -> untyped
|
|
20
|
+
def sync_inheritance_indexes: (String child, Array[String] parents, features features, bool prune) -> untyped
|
|
21
|
+
def sync_inheritance_unique_constraints: (String child, Array[String] parents, bool prune) -> untyped
|
|
22
|
+
def sync_inheritance_exclusion_constraints: (String child, Array[String] parents, bool prune) -> untyped
|
|
23
|
+
def sync_inheritance_foreign_keys: (String child, Array[String] parents, bool prune) -> untyped
|
|
24
|
+
def sync_inheritance_name: (String child, String parent, String source) -> String
|
|
25
|
+
def sync_inheritance_copy?: (String | Symbol name) -> bool
|
|
26
|
+
def sync_inheritance_stale: (Array[untyped] existing, Hash[String, untyped] expected) -> Array[String]
|
|
27
|
+
def sync_inheritance_constraint_indexes: (String table_name, ?features? features) -> Array[String]
|
|
28
|
+
def sync_inheritance_index_options: (ActiveRecord::ConnectionAdapters::IndexDefinition index) -> Hash[Symbol, untyped]
|
|
29
|
+
def sync_inheritance_index?: (ActiveRecord::ConnectionAdapters::IndexDefinition current, ActiveRecord::ConnectionAdapters::IndexDefinition source) -> bool
|
|
30
|
+
def sync_inheritance_exclusion?: (untyped current, untyped source) -> bool
|
|
31
|
+
def sync_inheritance_foreign_key?: (untyped current, untyped source) -> bool
|
|
32
|
+
def sync_inheritance_parent_primary_key?: (table_ref table_name) -> bool
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Adapter
|
|
4
|
+
module OID
|
|
5
|
+
module Array
|
|
6
|
+
def force_equality?: (untyped value) -> bool
|
|
7
|
+
|
|
8
|
+
private
|
|
9
|
+
|
|
10
|
+
def type_cast_array: (untyped value, Symbol method) -> untyped
|
|
11
|
+
def path_subtype?: () -> bool
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
class ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Array[unchecked out Elem]
|
|
19
|
+
prepend Torque::PostgreSQL::Adapter::OID::Array
|
|
20
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
class Box < ::Struct[untyped]
|
|
4
|
+
def x1: () -> Numeric
|
|
5
|
+
def x1=: (Numeric value) -> Numeric
|
|
6
|
+
def y1: () -> Numeric
|
|
7
|
+
def y1=: (Numeric value) -> Numeric
|
|
8
|
+
def x2: () -> Numeric
|
|
9
|
+
def x2=: (Numeric value) -> Numeric
|
|
10
|
+
def y2: () -> Numeric
|
|
11
|
+
def y2=: (Numeric value) -> Numeric
|
|
12
|
+
|
|
13
|
+
def points: () -> Array[untyped]
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
module Adapter
|
|
17
|
+
module OID
|
|
18
|
+
class Box < Torque::PostgreSQL::GeometryBuilder
|
|
19
|
+
PIECES: ::Array[Symbol]
|
|
20
|
+
FORMATION: String
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
class ActiveRecord::Box < Torque::PostgreSQL::Box
|
|
28
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
class Circle < ::Struct[untyped]
|
|
4
|
+
def x: () -> Numeric
|
|
5
|
+
def x=: (Numeric value) -> Numeric
|
|
6
|
+
def y: () -> Numeric
|
|
7
|
+
def y=: (Numeric value) -> Numeric
|
|
8
|
+
def r: () -> Numeric
|
|
9
|
+
def r=: (Numeric value) -> Numeric
|
|
10
|
+
alias radius r
|
|
11
|
+
alias radius= r=
|
|
12
|
+
|
|
13
|
+
def center: () -> untyped
|
|
14
|
+
def center=: (untyped value) -> Numeric
|
|
15
|
+
|
|
16
|
+
private
|
|
17
|
+
|
|
18
|
+
def point_class: () -> Class
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
module Adapter
|
|
22
|
+
module OID
|
|
23
|
+
class Circle < Torque::PostgreSQL::GeometryBuilder
|
|
24
|
+
PIECES: ::Array[Symbol]
|
|
25
|
+
FORMATION: String
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
class ActiveRecord::Circle < Torque::PostgreSQL::Circle
|
|
33
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Adapter
|
|
4
|
+
module OID
|
|
5
|
+
class Composite < ActiveModel::Type::Value
|
|
6
|
+
ARRAY: singleton(ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Array)
|
|
7
|
+
DATA: untyped
|
|
8
|
+
ENCODER: untyped
|
|
9
|
+
DECODER: untyped
|
|
10
|
+
|
|
11
|
+
attr_reader name: String
|
|
12
|
+
|
|
13
|
+
def self.from: (untyped type) -> Composite?
|
|
14
|
+
def self.create: (Hash[String, untyped] row, ActiveRecord::Type::HashLookupTypeMap type_map) -> untyped
|
|
15
|
+
def initialize: (table_ref name) -> void
|
|
16
|
+
def klass: () -> singleton(Attributes::Composite)
|
|
17
|
+
def columns: () -> Hash[String, type_caster]
|
|
18
|
+
def type: () -> :composite
|
|
19
|
+
def cast: (untyped value) -> untyped
|
|
20
|
+
def deserialize: (untyped value) -> Attributes::Composite?
|
|
21
|
+
def serialize: (untyped value) -> untyped
|
|
22
|
+
def changed_in_place?: (untyped raw_old_value, untyped new_value) -> bool
|
|
23
|
+
def ==: (untyped other) -> bool
|
|
24
|
+
alias eql? ==
|
|
25
|
+
def hash: () -> Integer
|
|
26
|
+
|
|
27
|
+
private
|
|
28
|
+
|
|
29
|
+
def build: (Hash[column_ref, untyped] attrs) -> Attributes::Composite
|
|
30
|
+
def attributes_of: (Attributes::Composite record) -> ActiveModel::AttributeSet
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Adapter
|
|
4
|
+
module OID
|
|
5
|
+
class Enum < ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Enum
|
|
6
|
+
type row = Hash[String, untyped]
|
|
7
|
+
|
|
8
|
+
attr_reader name: String
|
|
9
|
+
attr_reader klass: singleton(Attributes::Enum) | singleton(Attributes::EnumSet)
|
|
10
|
+
attr_reader set_klass: EnumSet?
|
|
11
|
+
attr_reader enum_klass: Enum | singleton(Attributes::Enum)
|
|
12
|
+
|
|
13
|
+
def self.create: (row row, ActiveRecord::Type::HashLookupTypeMap type_map) -> untyped
|
|
14
|
+
def initialize: (String name) -> void
|
|
15
|
+
def hash: () -> Integer
|
|
16
|
+
def serialize: (untyped value) -> String?
|
|
17
|
+
def assert_valid_value: (untyped value) -> untyped
|
|
18
|
+
def type_cast_for_schema: (untyped value) -> String
|
|
19
|
+
def ==: (untyped other) -> bool
|
|
20
|
+
|
|
21
|
+
private
|
|
22
|
+
|
|
23
|
+
def cast_value: (untyped value) -> untyped
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Adapter
|
|
4
|
+
module OID
|
|
5
|
+
class EnumSet < Enum
|
|
6
|
+
def initialize: (String name, singleton(Attributes::Enum) enum_klass) -> void
|
|
7
|
+
def type: () -> :enum
|
|
8
|
+
def deserialize: (untyped value) -> untyped
|
|
9
|
+
def serialize: (untyped value) -> String?
|
|
10
|
+
def type_cast_for_schema: (untyped value) -> String
|
|
11
|
+
|
|
12
|
+
private
|
|
13
|
+
|
|
14
|
+
def cast_value: (untyped value) -> untyped
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Adapter
|
|
4
|
+
module OID
|
|
5
|
+
class Interval < ActiveModel::Type::Value
|
|
6
|
+
CAST_PARTS: ::Array[Symbol]
|
|
7
|
+
|
|
8
|
+
def type: () -> :interval
|
|
9
|
+
def cast: (untyped value) -> untyped
|
|
10
|
+
def deserialize: (String? value) -> ActiveSupport::Duration?
|
|
11
|
+
def serialize: (untyped value) -> String?
|
|
12
|
+
def type_cast_for_schema: (untyped value) -> String
|
|
13
|
+
def assert_valid_value: (untyped value) -> nil
|
|
14
|
+
def parts_to_duration: (Hash[untyped, untyped] | ::Array[untyped] parts) -> ActiveSupport::Duration
|
|
15
|
+
def remove_weeks: (ActiveSupport::Duration value) -> ActiveSupport::Duration
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
class Line < ::Struct[untyped]
|
|
4
|
+
def slope: () -> (Rational | Float)
|
|
5
|
+
def slope=: (Rational | Float value) -> (Rational | Float)
|
|
6
|
+
def intercept: () -> Numeric
|
|
7
|
+
def intercept=: (Numeric value) -> Numeric
|
|
8
|
+
alias c intercept
|
|
9
|
+
alias c= intercept=
|
|
10
|
+
|
|
11
|
+
def a=: (Numeric value) -> (Rational | Float)
|
|
12
|
+
def a: () -> Numeric
|
|
13
|
+
def b=: (Numeric value) -> (Rational | Float)
|
|
14
|
+
def b: () -> Numeric
|
|
15
|
+
def horizontal?: () -> bool
|
|
16
|
+
def vertical?: () -> bool
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
module Adapter
|
|
20
|
+
module OID
|
|
21
|
+
class Line < Torque::PostgreSQL::GeometryBuilder
|
|
22
|
+
PIECES: ::Array[Symbol]
|
|
23
|
+
FORMATION: String
|
|
24
|
+
|
|
25
|
+
def build_klass: (*untyped args) -> untyped
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
class ActiveRecord::Line < Torque::PostgreSQL::Line
|
|
33
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Adapter
|
|
4
|
+
module OID
|
|
5
|
+
class Lquery < Ltree
|
|
6
|
+
STAR: Regexp
|
|
7
|
+
|
|
8
|
+
def type: () -> :lquery
|
|
9
|
+
|
|
10
|
+
private
|
|
11
|
+
|
|
12
|
+
def value_class: () -> singleton(Attributes::LQuery)
|
|
13
|
+
def items_of: (untyped entry, bool sanitize) -> ::Array[untyped]
|
|
14
|
+
def compile: (untyped item) -> String
|
|
15
|
+
def quantifier: (::Range[Integer?] range) -> String
|
|
16
|
+
def parse: (String text) -> (String | Symbol | ::Array[String] | ::Range[Integer?])
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Adapter
|
|
4
|
+
module OID
|
|
5
|
+
class Ltree < ActiveModel::Type::Value
|
|
6
|
+
type path = Attributes::LTree | Attributes::LQuery
|
|
7
|
+
|
|
8
|
+
def type: () -> :ltree
|
|
9
|
+
def cast: (untyped value) -> path?
|
|
10
|
+
def serialize: (untyped value) -> String?
|
|
11
|
+
def deserialize: (String? value) -> path?
|
|
12
|
+
def items_for: (untyped value, ?sanitize: bool) -> ::Array[untyped]
|
|
13
|
+
def type_cast_for_schema: (untyped value) -> String
|
|
14
|
+
def changed_in_place?: (String? raw_old_value, untyped new_value) -> bool
|
|
15
|
+
def ==: (untyped other) -> bool
|
|
16
|
+
alias eql? ==
|
|
17
|
+
def hash: () -> Integer
|
|
18
|
+
|
|
19
|
+
private
|
|
20
|
+
|
|
21
|
+
def value_class: () -> (singleton(Attributes::LTree) | singleton(Attributes::LQuery))
|
|
22
|
+
def items_of: (untyped entry, bool sanitize) -> ::Array[untyped]
|
|
23
|
+
def labels_of: (String text, bool sanitize) -> ::Array[untyped]
|
|
24
|
+
def record_label: (record record) -> String
|
|
25
|
+
def sanitize: (String text) -> String
|
|
26
|
+
def compile: (untyped item) -> String
|
|
27
|
+
def parse: (String text) -> untyped
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Adapter
|
|
4
|
+
module OID
|
|
5
|
+
class Range < ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Range[untyped]
|
|
6
|
+
HASH_PICK: ::Array[Symbol]
|
|
7
|
+
|
|
8
|
+
module Comparison
|
|
9
|
+
def <=>: (untyped other) -> Integer?
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def cast_value: (untyped value) -> untyped
|
|
13
|
+
def map: (untyped value) { (untyped) -> untyped } -> untyped
|
|
14
|
+
|
|
15
|
+
private
|
|
16
|
+
|
|
17
|
+
def cast_custom: (untyped from, untyped to) -> ::Range[untyped]
|
|
18
|
+
def custom_cast_single: (untyped value, ?bool negative) -> untyped
|
|
19
|
+
def custom_infinity: (bool negative) -> Float
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
class Float
|
|
27
|
+
prepend Torque::PostgreSQL::Adapter::OID::Range::Comparison
|
|
28
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
class Segment < ::Struct[untyped]
|
|
4
|
+
def point0: () -> untyped
|
|
5
|
+
def point0=: (untyped value) -> untyped
|
|
6
|
+
def point1: () -> untyped
|
|
7
|
+
def point1=: (untyped value) -> untyped
|
|
8
|
+
|
|
9
|
+
def x1=: (Numeric value) -> untyped
|
|
10
|
+
def x1: () -> Numeric
|
|
11
|
+
def y1=: (Numeric value) -> untyped
|
|
12
|
+
def y1: () -> Numeric
|
|
13
|
+
def x2=: (Numeric value) -> untyped
|
|
14
|
+
def x2: () -> Numeric
|
|
15
|
+
def y2=: (Numeric value) -> untyped
|
|
16
|
+
def y2: () -> Numeric
|
|
17
|
+
|
|
18
|
+
private
|
|
19
|
+
|
|
20
|
+
def new_point: (Numeric x, Numeric y) -> untyped
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
module Adapter
|
|
24
|
+
module OID
|
|
25
|
+
class Segment < Torque::PostgreSQL::GeometryBuilder
|
|
26
|
+
PIECES: ::Array[Symbol]
|
|
27
|
+
FORMATION: String
|
|
28
|
+
|
|
29
|
+
def point_class: () -> Class
|
|
30
|
+
def build_klass: (*untyped args) -> untyped
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
class ActiveRecord::Segment < Torque::PostgreSQL::Segment
|
|
38
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Adapter
|
|
4
|
+
module OID
|
|
5
|
+
class Struct < ActiveRecord::Type::Json
|
|
6
|
+
type backfill = bool | column_ref | ::Array[column_ref] | nil
|
|
7
|
+
type document = Hash[String, untyped]
|
|
8
|
+
|
|
9
|
+
attr_reader klass: Class
|
|
10
|
+
attr_reader type: Symbol
|
|
11
|
+
attr_reader backfill: backfill
|
|
12
|
+
|
|
13
|
+
@without_backfill: Struct
|
|
14
|
+
|
|
15
|
+
def self.state: (untyped value) -> untyped
|
|
16
|
+
def initialize: (Class klass, ?type: Symbol, ?backfill: backfill) -> void
|
|
17
|
+
def cast: (untyped value) -> untyped
|
|
18
|
+
def deserialize: (String | Hash[untyped, untyped] | nil value) -> untyped
|
|
19
|
+
def serialize: (untyped value) -> String?
|
|
20
|
+
def changed?: (untyped old_value, untyped new_value, untyped _new_value_before_cast) -> bool
|
|
21
|
+
def changed_in_place?: (String? raw_old_value, untyped new_value) -> bool
|
|
22
|
+
def without_backfill: () -> Struct
|
|
23
|
+
def empty?: (untyped value) -> bool
|
|
24
|
+
def document_for: (untyped value) -> document?
|
|
25
|
+
def document: (untyped value) -> document
|
|
26
|
+
def blank_document: () -> document
|
|
27
|
+
def ==: (untyped other) -> bool
|
|
28
|
+
alias eql? ==
|
|
29
|
+
def hash: () -> Integer
|
|
30
|
+
|
|
31
|
+
private
|
|
32
|
+
|
|
33
|
+
def parse: (untyped value) -> untyped
|
|
34
|
+
def build: (untyped data, ?from_database: bool, ?blank: bool) -> untyped
|
|
35
|
+
def blank!: (untyped instance) -> untyped
|
|
36
|
+
def load: (untyped instance, Hash[column_ref, untyped] data) -> untyped
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Adapter
|
|
4
|
+
module OID
|
|
5
|
+
class StructList < Struct
|
|
6
|
+
def cast: (untyped value) -> untyped
|
|
7
|
+
def deserialize: (untyped value) -> ::Array[Attributes::Struct]
|
|
8
|
+
def serialize: (untyped value) -> String?
|
|
9
|
+
def document_for: (untyped value) -> ::Array[untyped]
|
|
10
|
+
def empty?: (untyped value) -> bool
|
|
11
|
+
def blank_document: () -> ::Array[untyped]
|
|
12
|
+
|
|
13
|
+
private
|
|
14
|
+
|
|
15
|
+
def encode: (::Array[untyped] items) -> String
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Adapter
|
|
4
|
+
module OID
|
|
5
|
+
class StructSet < ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Array[untyped]
|
|
6
|
+
@without_backfill: StructSet
|
|
7
|
+
|
|
8
|
+
def deserialize: (untyped value) -> ::Array[untyped]
|
|
9
|
+
def serialize: (untyped value) -> untyped
|
|
10
|
+
def changed_in_place?: (untyped raw_old_value, untyped new_value) -> bool
|
|
11
|
+
def without_backfill: () -> StructSet
|
|
12
|
+
def empty?: (untyped value) -> bool
|
|
13
|
+
def blank_document: () -> ::Array[untyped]
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Adapter
|
|
4
|
+
module Quoting
|
|
5
|
+
type name = table_ref
|
|
6
|
+
|
|
7
|
+
QUOTED_TYPE_NAMES: untyped
|
|
8
|
+
Name: singleton(ActiveRecord::ConnectionAdapters::PostgreSQL::Name)
|
|
9
|
+
Column: singleton(ActiveRecord::ConnectionAdapters::PostgreSQL::Column)
|
|
10
|
+
ColumnDefinition: untyped
|
|
11
|
+
Utils: singleton(ActiveRecord::ConnectionAdapters::PostgreSQL::Utils)
|
|
12
|
+
|
|
13
|
+
def quote_type_name: (name name, *table_ref args) -> String
|
|
14
|
+
def quote_identifier_name: (name name, ?table_ref? schema) -> String
|
|
15
|
+
def quote_default_expression: (untyped value, untyped column) -> String
|
|
16
|
+
def lookup_cast_type_for_column: (column column) -> type_caster
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Adapter
|
|
4
|
+
module SchemaCreation
|
|
5
|
+
def add_table_options!: (String create_sql, ActiveRecord::ConnectionAdapters::TableDefinition o) -> String
|
|
6
|
+
end
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
class ActiveRecord::ConnectionAdapters::PostgreSQL::SchemaCreation
|
|
12
|
+
prepend Torque::PostgreSQL::Adapter::SchemaCreation
|
|
13
|
+
end
|