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,32 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Associations
|
|
4
|
+
module Preloader
|
|
5
|
+
module Association
|
|
6
|
+
@run: bool
|
|
7
|
+
@records_by_owner: Hash[record, Array[record]]
|
|
8
|
+
@preloaded_records: Array[record]
|
|
9
|
+
@owners_by_key: Hash[untyped, Array[record]]
|
|
10
|
+
|
|
11
|
+
def connected_through_array?: () -> untyped
|
|
12
|
+
def run: () -> self
|
|
13
|
+
def set_inverse: (record record) -> untyped
|
|
14
|
+
def load_records: (?Array[record]? raw_records) -> untyped
|
|
15
|
+
def owners_by_key: () -> Hash[untyped, Array[record]]
|
|
16
|
+
|
|
17
|
+
private
|
|
18
|
+
|
|
19
|
+
def run_array_for_belongs_to_many: () -> untyped
|
|
20
|
+
def run_array_for_has_many: () -> untyped
|
|
21
|
+
def records_for: (Array[untyped] ids) ?{ (record) -> void } -> Array[record]
|
|
22
|
+
def associate_records_to_owner: (record owner, Array[record] records) -> untyped
|
|
23
|
+
def groupped_records: () -> Hash[untyped, Array[record]]
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
class ActiveRecord::Associations::Preloader::Association
|
|
31
|
+
prepend Torque::PostgreSQL::Associations::Preloader::Association
|
|
32
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Associations
|
|
4
|
+
module Preloader
|
|
5
|
+
module LoaderQuery
|
|
6
|
+
@foreign_column: column?
|
|
7
|
+
|
|
8
|
+
def foreign_column: () -> column?
|
|
9
|
+
def load_records_for_keys: (Enumerable[untyped] keys) ?{ (record) -> void } -> (Array[record] | relation)
|
|
10
|
+
def query_condition_for: (Enumerable[untyped] keys) -> arel_node?
|
|
11
|
+
def connected_through_array?: () -> untyped
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
class ActiveRecord::Associations::Preloader::Association::LoaderQuery
|
|
19
|
+
prepend Torque::PostgreSQL::Associations::Preloader::LoaderQuery
|
|
20
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Associations
|
|
4
|
+
class BelongsToManyAssociation
|
|
5
|
+
prepend ForeignAssociation
|
|
6
|
+
end
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
class ActiveRecord::Associations::HasManyAssociation
|
|
12
|
+
prepend Torque::PostgreSQL::Associations::ForeignAssociation
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
class ActiveRecord::Associations::JoinDependency
|
|
16
|
+
prepend Torque::PostgreSQL::Associations::JoinDependency
|
|
17
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Attributes
|
|
4
|
+
class Base
|
|
5
|
+
include ActiveModel::Model
|
|
6
|
+
include ActiveModel::Attributes
|
|
7
|
+
include ActiveModel::Serialization
|
|
8
|
+
include ActiveModel::Serializers::JSON
|
|
9
|
+
include ActiveModel::Dirty
|
|
10
|
+
include ActiveModel::Validations::Callbacks
|
|
11
|
+
include SimpleEnum
|
|
12
|
+
extend SimpleEnum::ClassMethods
|
|
13
|
+
include ActiveRecord::Store
|
|
14
|
+
include ActiveModel::Attributes::Normalization
|
|
15
|
+
include ActiveRecord::Encryption::EncryptableRecord
|
|
16
|
+
|
|
17
|
+
def self.filter_attributes: () -> Array[Symbol | String | Regexp | Proc]
|
|
18
|
+
def self.filter_attributes=: (Array[Symbol | String | Regexp | Proc] value) -> Array[Symbol | String | Regexp | Proc]
|
|
19
|
+
def self.columns_hash: () -> Hash[String, column]
|
|
20
|
+
def self.encrypts: (*column_ref names, **untyped options) -> untyped
|
|
21
|
+
def self.inspection_filter: () -> ActiveSupport::ParameterFilter
|
|
22
|
+
|
|
23
|
+
def inspect: () -> String
|
|
24
|
+
def []: (column_ref key) -> untyped
|
|
25
|
+
def []=: (column_ref key, untyped value) -> untyped
|
|
26
|
+
def ==: (untyped other) -> bool
|
|
27
|
+
alias eql? ==
|
|
28
|
+
def empty?: () -> bool
|
|
29
|
+
def hash: () -> Integer
|
|
30
|
+
def to_h: () -> Hash[Symbol, untyped]
|
|
31
|
+
def type_for_attribute: (column_ref name) ?{ (?) -> untyped } -> type_caster
|
|
32
|
+
def read_attribute_before_type_cast: (column_ref name) -> untyped
|
|
33
|
+
def read_attribute_for_database: (column_ref name) -> untyped
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Attributes
|
|
4
|
+
module Builder
|
|
5
|
+
class Enum
|
|
6
|
+
type methods = Hash[String, [String, String, String, String]]
|
|
7
|
+
|
|
8
|
+
VALID_TYPES: Array[Symbol]
|
|
9
|
+
FN: String
|
|
10
|
+
|
|
11
|
+
attr_accessor klass: model
|
|
12
|
+
attr_accessor attribute: String
|
|
13
|
+
attr_accessor subtype: Adapter::OID::Enum
|
|
14
|
+
attr_accessor options: Hash[Symbol, untyped]
|
|
15
|
+
attr_accessor values: Array[String]
|
|
16
|
+
attr_accessor klass_module: Module?
|
|
17
|
+
attr_accessor instance_module: Module?
|
|
18
|
+
|
|
19
|
+
@values_methods: methods
|
|
20
|
+
|
|
21
|
+
def initialize: (model klass, column_ref attribute, Hash[Symbol, untyped] options) -> void
|
|
22
|
+
def values_methods: () -> methods
|
|
23
|
+
def set_features?: () -> bool
|
|
24
|
+
def conflicting?: () -> untyped
|
|
25
|
+
def build: () -> untyped
|
|
26
|
+
|
|
27
|
+
private
|
|
28
|
+
|
|
29
|
+
def dangerous?: (String | Symbol method_name, ?bool class_method) -> untyped
|
|
30
|
+
def plural: () -> untyped
|
|
31
|
+
def set_scopes: () -> untyped
|
|
32
|
+
def stringify: () -> untyped
|
|
33
|
+
def all_values: () -> untyped
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Attributes
|
|
4
|
+
module Builder
|
|
5
|
+
class FullTextSearch
|
|
6
|
+
attr_accessor klass: model
|
|
7
|
+
attr_accessor attribute: column_ref
|
|
8
|
+
attr_accessor options: Hash[Symbol, untyped]
|
|
9
|
+
attr_accessor klass_module: Module?
|
|
10
|
+
attr_accessor default_rank: String?
|
|
11
|
+
attr_accessor default_mode: Symbol
|
|
12
|
+
attr_accessor default_order: (:asc | :desc | false)
|
|
13
|
+
attr_accessor default_language: String | Symbol
|
|
14
|
+
|
|
15
|
+
@scope_name: String
|
|
16
|
+
|
|
17
|
+
def initialize: (model klass, column_ref attribute, ?Hash[Symbol, untyped] options) -> void
|
|
18
|
+
def scope_name: () -> String
|
|
19
|
+
def conflicting?: () -> untyped
|
|
20
|
+
def build: () -> untyped
|
|
21
|
+
def add_scope_to_module: () -> untyped
|
|
22
|
+
def scope_args: () -> String
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Attributes
|
|
4
|
+
module Builder
|
|
5
|
+
class Period
|
|
6
|
+
type threshold = Symbol | ActiveSupport::Duration | Numeric | nil
|
|
7
|
+
type method_names = Hash[Symbol, String | Symbol]
|
|
8
|
+
|
|
9
|
+
DIRECT_ACCESS_REGEX: Regexp
|
|
10
|
+
SUPPORTED_TYPES: Array[Symbol]
|
|
11
|
+
CURRENT_GETTERS: Hash[Symbol, String]
|
|
12
|
+
TYPE_CASTERS: Hash[Symbol, Symbol]
|
|
13
|
+
FN: String
|
|
14
|
+
|
|
15
|
+
attr_accessor klass: model
|
|
16
|
+
attr_accessor attribute: String
|
|
17
|
+
attr_accessor options: Hash[Symbol, untyped]
|
|
18
|
+
attr_accessor type: Symbol
|
|
19
|
+
attr_accessor default: bool
|
|
20
|
+
attr_accessor current_getter: String
|
|
21
|
+
attr_accessor type_caster: Symbol
|
|
22
|
+
attr_writer threshold: threshold
|
|
23
|
+
attr_accessor dynamic_threshold: untyped
|
|
24
|
+
attr_accessor klass_module: Module?
|
|
25
|
+
attr_accessor instance_module: Module?
|
|
26
|
+
|
|
27
|
+
@threshold: threshold
|
|
28
|
+
@method_names: method_names
|
|
29
|
+
@klass_method_names: method_names
|
|
30
|
+
@instance_method_names: method_names
|
|
31
|
+
@arel_attribute: String
|
|
32
|
+
@arel_default_sql: String
|
|
33
|
+
@arel_threshold_value: String?
|
|
34
|
+
@arel_start_at: String
|
|
35
|
+
@arel_finish_at: String
|
|
36
|
+
@arel_real_start_at: String
|
|
37
|
+
@arel_real_finish_at: String
|
|
38
|
+
@arel_real_attribute: String
|
|
39
|
+
|
|
40
|
+
def initialize: (model klass, column_ref attribute, Hash[Symbol, untyped] options) -> void
|
|
41
|
+
def threshold: () -> threshold
|
|
42
|
+
def method_names: () -> method_names
|
|
43
|
+
def klass_method_names: () -> method_names
|
|
44
|
+
def instance_method_names: () -> method_names
|
|
45
|
+
def conflicting?: () -> untyped
|
|
46
|
+
def build: () -> untyped
|
|
47
|
+
def build_method_helper: (Symbol type, Symbol key, ?Array[String] args) -> untyped
|
|
48
|
+
|
|
49
|
+
private
|
|
50
|
+
|
|
51
|
+
def default_method_names: () -> method_names
|
|
52
|
+
def dangerous?: (String | Symbol method_name, ?bool class_method) -> untyped
|
|
53
|
+
def define_string_method: (String | Symbol name, String body, ?Array[String] args) -> String
|
|
54
|
+
def arel_attribute: () -> String
|
|
55
|
+
def arel_default_sql: () -> String
|
|
56
|
+
def arel_sql_bind: (String value) -> String
|
|
57
|
+
def arel_threshold_value: () -> String?
|
|
58
|
+
def arel_start_at: () -> String
|
|
59
|
+
def arel_finish_at: () -> String
|
|
60
|
+
def arel_real_start_at: () -> String
|
|
61
|
+
def arel_real_finish_at: () -> String
|
|
62
|
+
def arel_real_attribute: () -> String
|
|
63
|
+
def arel_convert_to_type: (String left, ?String? right, ?Symbol? set_type) -> String
|
|
64
|
+
def arel_named_function: (String | Symbol name, *String args) -> String
|
|
65
|
+
def arel_nullif: (*String args) -> String
|
|
66
|
+
def arel_coalesce: (*String args) -> String
|
|
67
|
+
def arel_empty_value: () -> String
|
|
68
|
+
def arel_daterange: (?bool real) -> String
|
|
69
|
+
def arel_check_condition: (Symbol type) -> String
|
|
70
|
+
def arel_formatting_value: (?String? condition, ?String value, ?cast: Symbol?) -> String
|
|
71
|
+
def arel_formatting_left_right: (String condition, ?Symbol? set_type, ?cast: Symbol?) -> String
|
|
72
|
+
def klass_current_on: () -> String
|
|
73
|
+
def klass_current: () -> String
|
|
74
|
+
def klass_not_current: () -> String
|
|
75
|
+
def klass_containing: () -> String
|
|
76
|
+
def klass_not_containing: () -> String
|
|
77
|
+
def klass_overlapping: () -> String
|
|
78
|
+
def klass_not_overlapping: () -> String
|
|
79
|
+
def klass_starting_after: () -> String
|
|
80
|
+
def klass_starting_before: () -> String
|
|
81
|
+
def klass_finishing_after: () -> String
|
|
82
|
+
def klass_finishing_before: () -> String
|
|
83
|
+
def klass_real_containing: () -> String
|
|
84
|
+
def klass_real_overlapping: () -> String
|
|
85
|
+
def klass_real_starting_after: () -> String
|
|
86
|
+
def klass_real_starting_before: () -> String
|
|
87
|
+
def klass_real_finishing_after: () -> String
|
|
88
|
+
def klass_real_finishing_before: () -> String
|
|
89
|
+
def klass_containing_date: () -> String
|
|
90
|
+
def klass_not_containing_date: () -> String
|
|
91
|
+
def klass_overlapping_date: () -> String
|
|
92
|
+
def klass_not_overlapping_date: () -> String
|
|
93
|
+
def klass_real_containing_date: () -> String
|
|
94
|
+
def klass_real_overlapping_date: () -> String
|
|
95
|
+
def instance_current?: () -> String
|
|
96
|
+
def instance_current_on?: () -> String
|
|
97
|
+
def instance_start: () -> String
|
|
98
|
+
def instance_finish: () -> String
|
|
99
|
+
def instance_real: () -> String
|
|
100
|
+
def instance_real_start: () -> String
|
|
101
|
+
def instance_real_finish: () -> String
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# The macros these builders install on models (torque_enum, torque_enum_set,
|
|
2
|
+
# period_for, torque_search_for, struct_for) are declared under their default
|
|
3
|
+
# names next to each feature. The per-attribute methods they generate, like
|
|
4
|
+
# `roles`, `admin?`, the period scopes and the search scope, depend on the
|
|
5
|
+
# model's columns and on config, so RBS cannot express them.
|
|
6
|
+
module Torque
|
|
7
|
+
module PostgreSQL
|
|
8
|
+
module Attributes
|
|
9
|
+
module Builder
|
|
10
|
+
type builder_class = singleton(Enum) | singleton(Period) | singleton(FullTextSearch)
|
|
11
|
+
|
|
12
|
+
def self.include_on: (model klass, Symbol method_name, builder_class builder_klass, **untyped extra) ?{ (Enum | Period | FullTextSearch builder) -> void } -> untyped
|
|
13
|
+
def self.search_vector_options: (columns: Adapter::search_columns, ?language: String | Symbol | nil, ?stored: bool, **untyped options) -> Hash[Symbol, untyped]
|
|
14
|
+
def self.to_search_weights: (Adapter::search_columns columns) -> Hash[String, String]
|
|
15
|
+
def self.to_search_vector_operation: (String | Symbol | nil language, Hash[String, String] weights) -> arel_node
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Attributes
|
|
4
|
+
class Composite < Base
|
|
5
|
+
@type_name: String
|
|
6
|
+
@columns: Hash[String, type_caster]
|
|
7
|
+
@load_columns_monitor: Monitor
|
|
8
|
+
|
|
9
|
+
def self.type_name=: (String value) -> String
|
|
10
|
+
def self.lookup: (table_ref name) -> singleton(Composite)
|
|
11
|
+
def self.inherited: (singleton(Composite) subclass) -> untyped
|
|
12
|
+
def self.type_name: () -> String
|
|
13
|
+
def self.columns: () -> Hash[String, type_caster]?
|
|
14
|
+
def self.load_columns: () -> untyped
|
|
15
|
+
def self.reset_columns!: () -> untyped
|
|
16
|
+
def self.new: (*untyped args, **untyped xargs) ?{ (?) -> untyped } -> instance
|
|
17
|
+
def self.encrypts: (*column_ref names, **untyped options) -> untyped
|
|
18
|
+
def self.enum: (column_ref name, ?SimpleEnum::values values, **untyped options) -> untyped
|
|
19
|
+
|
|
20
|
+
private
|
|
21
|
+
|
|
22
|
+
def self.resolve: (singleton(Composite) klass, String name) -> singleton(Composite)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
class Composite = Attributes::Composite
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
module Torque
|
|
2
|
+
module PostgreSQL
|
|
3
|
+
module Attributes
|
|
4
|
+
class Enum < String
|
|
5
|
+
include Comparable
|
|
6
|
+
extend Enumerable[untyped]
|
|
7
|
+
|
|
8
|
+
class EnumError < ArgumentError
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
LAZY_VALUE: String
|
|
12
|
+
|
|
13
|
+
@values: Array[String]
|
|
14
|
+
@type_name: String
|
|
15
|
+
@load_values_monitor: Monitor
|
|
16
|
+
|
|
17
|
+
def self.each: (*untyped) ?{ (instance) -> untyped } -> untyped
|
|
18
|
+
def self.sample: (*untyped) -> instance?
|
|
19
|
+
def self.size: () -> Integer
|
|
20
|
+
def self.length: () -> Integer
|
|
21
|
+
def self.lookup: (table_ref name) -> singleton(Enum)
|
|
22
|
+
def self.include_on: (model klass, ?Symbol? method_name) -> untyped
|
|
23
|
+
def self.new: (untyped value) -> untyped
|
|
24
|
+
def self.inherited: (singleton(Enum) subclass) -> untyped
|
|
25
|
+
def self.values: () -> Array[String]?
|
|
26
|
+
def self.keys: () -> Array[Symbol]
|
|
27
|
+
def self.members: () -> Array[instance]
|
|
28
|
+
def self.texts: () -> Array[String]
|
|
29
|
+
def self.to_options: () -> Array[[String, String]]
|
|
30
|
+
def self.fetch: (String | Symbol value, *untyped) -> instance?
|
|
31
|
+
alias self.[] self.fetch
|
|
32
|
+
def self.type_name: () -> String
|
|
33
|
+
def self.valid?: (untyped value) -> bool
|
|
34
|
+
def self.scope: (arel_attribute attribute, String | Symbol value) -> ::Arel::Nodes::Equality
|
|
35
|
+
|
|
36
|
+
private
|
|
37
|
+
|
|
38
|
+
def self.respond_to_missing?: (Symbol method_name, ?bool include_private) -> bool
|
|
39
|
+
def self.method_missing: (Symbol method_name, *untyped arguments) -> untyped
|
|
40
|
+
|
|
41
|
+
public
|
|
42
|
+
|
|
43
|
+
def initialize: (untyped value) -> void
|
|
44
|
+
def <=>: (untyped other) -> Integer?
|
|
45
|
+
def ==: (untyped other) -> bool
|
|
46
|
+
alias eql? ==
|
|
47
|
+
def nil?: () -> bool
|
|
48
|
+
alias empty? nil?
|
|
49
|
+
def replace: (String | Symbol value) -> self
|
|
50
|
+
def text: (?column_ref? attr, ?untyped model) -> String
|
|
51
|
+
def to_s: () -> String
|
|
52
|
+
def to_i: () -> Integer?
|
|
53
|
+
def inspect: () -> String
|
|
54
|
+
|
|
55
|
+
private
|
|
56
|
+
|
|
57
|
+
def i18n_keys: (?column_ref? attr, ?untyped model) -> Array[Symbol]
|
|
58
|
+
def respond_to_missing?: (Symbol method_name, ?bool include_private) -> untyped
|
|
59
|
+
def method_missing: (Symbol method_name, *untyped arguments) -> untyped
|
|
60
|
+
def raise_invalid: (untyped value) -> bot
|
|
61
|
+
def raise_comparison: (untyped other) -> bot
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
class ActiveRecord::Base
|
|
68
|
+
def self.torque_enum: (*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
|
|
69
|
+
end
|
|
@@ -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
|