quo 0.6.0 → 1.0.0.beta1

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 (67) hide show
  1. checksums.yaml +4 -4
  2. data/.standard.yml +4 -1
  3. data/Appraisals +15 -0
  4. data/CHANGELOG.md +78 -0
  5. data/Gemfile +6 -4
  6. data/LICENSE.txt +1 -1
  7. data/README.md +222 -232
  8. data/Steepfile +0 -2
  9. data/gemfiles/rails_7.0.gemfile +15 -0
  10. data/gemfiles/rails_7.1.gemfile +15 -0
  11. data/gemfiles/rails_7.2.gemfile +15 -0
  12. data/gemfiles/rails_8.0.gemfile +15 -0
  13. data/lib/quo/collection_backed_query.rb +87 -0
  14. data/lib/quo/collection_results.rb +44 -0
  15. data/lib/quo/composed_query.rb +278 -0
  16. data/lib/quo/engine.rb +11 -0
  17. data/lib/quo/minitest/helpers.rb +41 -0
  18. data/lib/quo/preloadable.rb +46 -0
  19. data/lib/quo/query.rb +97 -215
  20. data/lib/quo/relation_backed_query.rb +150 -0
  21. data/lib/quo/relation_backed_query_specification.rb +154 -0
  22. data/lib/quo/relation_results.rb +58 -0
  23. data/lib/quo/results.rb +48 -44
  24. data/lib/quo/rspec/helpers.rb +31 -9
  25. data/lib/quo/testing/collection_backed_fake.rb +29 -0
  26. data/lib/quo/testing/relation_backed_fake.rb +52 -0
  27. data/lib/quo/version.rb +3 -1
  28. data/lib/quo.rb +23 -30
  29. data/rbs_collection.yaml +0 -2
  30. data/sig/generated/quo/collection_backed_query.rbs +39 -0
  31. data/sig/generated/quo/collection_results.rbs +30 -0
  32. data/sig/generated/quo/composed_query.rbs +112 -0
  33. data/sig/generated/quo/engine.rbs +6 -0
  34. data/sig/generated/quo/preloadable.rbs +29 -0
  35. data/sig/generated/quo/query.rbs +98 -0
  36. data/sig/generated/quo/relation_backed_query.rbs +67 -0
  37. data/sig/generated/quo/relation_backed_query_specification.rbs +94 -0
  38. data/sig/generated/quo/relation_results.rbs +38 -0
  39. data/sig/generated/quo/results.rbs +39 -0
  40. data/sig/generated/quo/testing/collection_backed_fake.rbs +13 -0
  41. data/sig/generated/quo/testing/relation_backed_fake.rbs +23 -0
  42. data/sig/generated/quo/version.rbs +5 -0
  43. data/sig/generated/quo.rbs +9 -0
  44. data/sig/literal.rbs +7 -0
  45. metadata +77 -37
  46. data/lib/quo/eager_query.rb +0 -51
  47. data/lib/quo/loaded_query.rb +0 -18
  48. data/lib/quo/merged_query.rb +0 -36
  49. data/lib/quo/query_composer.rb +0 -78
  50. data/lib/quo/railtie.rb +0 -7
  51. data/lib/quo/utilities/callstack.rb +0 -21
  52. data/lib/quo/utilities/compose.rb +0 -18
  53. data/lib/quo/utilities/sanitize.rb +0 -19
  54. data/lib/quo/utilities/wrap.rb +0 -23
  55. data/lib/quo/wrapped_query.rb +0 -18
  56. data/sig/quo/eager_query.rbs +0 -15
  57. data/sig/quo/loaded_query.rbs +0 -7
  58. data/sig/quo/merged_query.rbs +0 -19
  59. data/sig/quo/query.rbs +0 -83
  60. data/sig/quo/query_composer.rbs +0 -32
  61. data/sig/quo/results.rbs +0 -22
  62. data/sig/quo/utilities/callstack.rbs +0 -7
  63. data/sig/quo/utilities/compose.rbs +0 -8
  64. data/sig/quo/utilities/sanitize.rbs +0 -9
  65. data/sig/quo/utilities/wrap.rbs +0 -11
  66. data/sig/quo/wrapped_query.rbs +0 -11
  67. data/sig/quo.rbs +0 -41
@@ -1,8 +0,0 @@
1
- module Quo
2
- module Utilities
3
- module Compose
4
- def compose: (composable query1, composable query2, ?joins: untyped?) -> Quo::MergedQuery
5
- def composable_with?: (queryOrRel query) -> bool
6
- end
7
- end
8
- end
@@ -1,9 +0,0 @@
1
- module Quo
2
- module Utilities
3
- module Sanitize
4
- def sanitize_sql_for_conditions: (untyped conditions) -> untyped?
5
- def sanitize_sql_string: (untyped string) -> untyped?
6
- def sanitize_sql_parameter: (untyped value) -> untyped?
7
- end
8
- end
9
- end
@@ -1,11 +0,0 @@
1
- module Quo
2
- module Utilities
3
- interface _Wrapable
4
- def new: (**untyped options) -> query
5
- end
6
-
7
- module Wrap : _Wrapable
8
- def wrap: (composable query_rel_or_data, **untyped options) -> query
9
- end
10
- end
11
- end
@@ -1,11 +0,0 @@
1
- module Quo
2
- class WrappedQuery < Quo::Query
3
- def self.build_from_options: (**untyped options) -> WrappedQuery
4
-
5
- @wrapped_query: ActiveRecord::Relation
6
-
7
- def initialize: (ActiveRecord::Relation query, **untyped options) -> void
8
-
9
- def query: () -> ActiveRecord::Relation
10
- end
11
- end
data/sig/quo.rbs DELETED
@@ -1,41 +0,0 @@
1
- module ActiveRecord
2
- module Associations
3
- class Preloader
4
- def initialize: (records: untyped, associations: untyped, ?scope: untyped, ?available_records: Array[untyped], ?associate_by_default: bool) -> void
5
- end
6
- end
7
- end
8
-
9
- module Quo
10
- VERSION: String
11
-
12
- type query = Quo::Query
13
- type queryOrRel = query | ActiveRecord::Relation
14
- type enumerable = Object & Enumerable[untyped]
15
- type relOrEnumerable = ActiveRecord::Relation | enumerable
16
- type loadedQueryOrEnumerable = LoadedQuery | EagerQuery | enumerable
17
- type composable = query | relOrEnumerable
18
-
19
- # TODO: how can we do the known options, eg `page` and then allow anything else?
20
- # Maybe we should separate out the known options from the unknown options
21
- type queryOptions = Hash[Symbol, untyped]
22
-
23
- interface _Logger
24
- def info: (String) -> void
25
- def error: (String) -> void
26
- def debug: (String) -> void
27
- end
28
-
29
- class Configuration
30
- attr_accessor formatted_query_log: bool?
31
- attr_accessor query_show_callstack_size: Integer?
32
- attr_accessor logger: _Logger?
33
- attr_accessor max_page_size: Integer?
34
- attr_accessor default_page_size: Integer?
35
-
36
- def initialize: () -> void
37
- end
38
- attr_reader self.configuration: Configuration
39
-
40
- def self.configure: () { (Configuration config) -> void } -> void
41
- end