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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 78b41f6d815238ed48ed00790498c1d6d7e8c099c0312fe82a441dcbe68d667f
4
- data.tar.gz: 84d11fe9c86ef448d17229f0544a1966f55597ce1a8522e4ef92b626fea24537
3
+ metadata.gz: f72639830288de3776524bb1003fc88aeeee4d1adf83abeb44dd42e48caa0bfb
4
+ data.tar.gz: f72435e5e5ef3832bcf993362f0b56252bc17edaaedb197455308195c71f6516
5
5
  SHA512:
6
- metadata.gz: dc89984c05233e3300c62149c457bec4e079c9d2dd646011c5fa348aaee3a66e59e627fcc93051ac992bd167df536b27d51784e241996dd548dde84b25ec3bde
7
- data.tar.gz: 1c3b41c2f541e96121b07bb3ce640846b3e308fcd018625d211b2f96a43ff4fe9cc0372d3bf8602c7fb22594c9935bb72bdd48041bde5e5eb391e6c3969a3ecc
6
+ metadata.gz: 64401d860bd1682d6b3d46d06f76eb644c9b3a3b1ad4d945b6d52b778d5deafe386f4588f9a7f381a8c484790711a3e0727f3d84f45469e8d53a787410741741
7
+ data.tar.gz: 5c148a23cc7ce4006fcac7c5cb9f6c118cbf08b35ea7b623743f48b3d36ae457d5902932a90669c5763e98db5df42b7ec31a470453752473821bc3e65ef7815d
data/.standard.yml CHANGED
@@ -1,3 +1,6 @@
1
1
  # For available configuration options, see:
2
2
  # https://github.com/testdouble/standard
3
- ruby_version: 2.6
3
+ ruby_version: 3.4
4
+ ignore:
5
+ - "**/*":
6
+ - "Layout/LeadingCommentSpace"
data/Appraisals ADDED
@@ -0,0 +1,15 @@
1
+ appraise "rails-7.0" do
2
+ gem "rails", "~> 7.0"
3
+ end
4
+
5
+ appraise "rails-7.1" do
6
+ gem "rails", "~> 7.1"
7
+ end
8
+
9
+ appraise "rails-7.2" do
10
+ gem "rails", "~> 7.2"
11
+ end
12
+
13
+ appraise "rails-8.0" do
14
+ gem "rails", "~> 8.0"
15
+ end
data/CHANGELOG.md CHANGED
@@ -1,5 +1,83 @@
1
1
  ## [Unreleased]
2
2
 
3
+
4
+ ## [1.0.0.rc1] - Unreleased
5
+
6
+ ### Breaking Changes
7
+
8
+ Nearly everything has had changes. Porting will require some effort.
9
+
10
+ - Quo now depends on `literal`, meaning attributes (options) to queries are typed and explicit
11
+ - Composing query objects now allows you to compose query classes rather than just instances of query objects
12
+ - `MergedQuery`, `EagerQuery` & `LoadedQuery` have been removed
13
+ - `Query` is now an abstract base class for `RelationBackedQuery` and `CollectionBackedQuery`
14
+ - The API of `Query` has been reduced/simplified significantly
15
+ - `Query` classes only build queries, to actually execute/take actions on them you need to call `#results` and get a `Results` object
16
+ - `preload`ing behaviour is now a separate concern from `Query` and is handled by `Preloadable` module.
17
+ - Drop support for Ruby <= 3.1 and Rails < 7.0
18
+ - Gem is now a Rails engine and relies on autoloading
19
+
20
+ ### Changed
21
+
22
+ - Update docs, dependencies, and tests
23
+ - Use appraisals for testing
24
+
25
+ ### Added
26
+
27
+ - Helpers `stub_query` and `mock_query` for Minitest
28
+
29
+ ## [0.5.0] - 2022-12-23
30
+
31
+ ### Changed
32
+
33
+ - Merged and Wrapped queries should not have factory methods as they are not meant to be constructed directly
34
+ - Create new LoadedQuery which separates the concern of "preloaded" Query from EagerQuery which represents a query which is loaded and memoized
35
+
36
+ ## [0.4.0] - 2022-12-23
37
+
38
+ ### Changed
39
+
40
+ - Some redundant nil checks (either safe navigation operator or conditionals) to make type check pass
41
+ - Fix for type of transform method which takes optional index as second arg
42
+ - group_by can take a block
43
+ - Change last and first methods to just take a limit value
44
+ - Add new configuration options for page size limit and default and fix typing for enumerable
45
+ - Rename Enumerator to Results and Query#enumerator to #results
46
+ - Change EagerQuery initializer to take collection as positional param
47
+
48
+ ## [0.3.1] - 2022-12-22
49
+
50
+ ### Changed
51
+
52
+ - Convenience methods on Query
53
+ - Implement group_by on enumerator to transform values in resulting groups
54
+ - Add WrappedQuery instead of Query taking a scope param
55
+ - Change `initialize` method of MergedQuery
56
+
57
+ ## [0.3.0] - 2022-12-20
58
+
59
+ ### Changed
60
+
61
+ - Make `joins` on compose a kwarg
62
+
63
+ ## [0.2.0] - 2022-12-20
64
+
65
+ ### Added
66
+
67
+ - Railtie for rake task
68
+ - Rake task which hackily looks for qo in the app and displays a list
69
+ - Prepare to add RBS types
70
+
71
+ ### Changed
72
+
73
+ - Gem deps
74
+ - Query interface
75
+
76
+ ### Added
77
+
78
+ - Test suite and dummy rails app
79
+ - Add Enumerator
80
+
3
81
  ## [0.1.0] - 2022-11-18
4
82
 
5
83
  - Initial release
data/Gemfile CHANGED
@@ -5,16 +5,18 @@ source "https://rubygems.org"
5
5
  # Specify your gem's dependencies in quo.gemspec
6
6
  gemspec
7
7
 
8
+ gem "rails", "~> 7.2"
9
+
8
10
  group :development, :test do
9
11
  gem "sqlite3"
10
12
 
11
- gem "rails", ">= 6", "< 8"
12
-
13
13
  gem "rake", "~> 13.0"
14
14
 
15
15
  gem "minitest", "~> 5.0"
16
16
 
17
- gem "standard", "~> 1.3"
17
+ gem "standard", require: false
18
+
19
+ gem "steep", require: false
18
20
 
19
- gem "steep", "~> 1.2"
21
+ gem "rbs-inline", "~> 0.11.0", require: false
20
22
  end
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2022 Stephen Ierodiaconou
3
+ Copyright (c) 2022-2025 Stephen Ierodiaconou
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal