sequel_count_comparisons 1.0.0 → 2.0.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b0dda31dca4ef83af94b35f825f9625af8dcb097804e73b5f616c3a2af3c99f2
4
- data.tar.gz: 8120c91e4dce2d96d210372f15d559cae1945c1f0e09ed3c0f57b2f4dc0790ae
3
+ metadata.gz: ced6b80b49999435cc463ecc48ab25bca414d9c70bb68a724818e153eac4d6a3
4
+ data.tar.gz: 6d86081df88ccffa77d0e351ab7f8030e39ddd6644be472f03a1584195c14ef4
5
5
  SHA512:
6
- metadata.gz: 05db3f4b5803e51c9e21453898178a57da956cb36b516870ad78c4f7cbba014d4c80dadc95a79bc5781fb8184de0ab605faa6d65f7a5f09d273f4a72f2701bd7
7
- data.tar.gz: 25ea2ae4e012e05c5e9e1abf3993b41a9900c1f50c9b97d63d0f23bfc00a2e2369b1279b91cc6a1f4715798f4904c903c2562044bf0e4e3b990fd34b6926b6f3
6
+ metadata.gz: dfcfb41e72e28b9fd36e5c7b83f456b465a353cc85331fbbbb995fcebe232dbfa4d1332816faa19e09cd97ddfe7139aafc0fd886fc5f49db296c20e996be78b3
7
+ data.tar.gz: c684ee9ac727f9589343975ca53d1eb9060cd9636d958c5842f719e5f2d5fe3534ecb20c0b109322d2434477971cbc12ccc5bd4144a25184df0f1fd3ff3f9a63
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ === 2.0.0 (2025-03-11)
2
+
3
+ * Drop #count_at_least? and #count_at_most?
4
+
1
5
  === 1.0.0 (2025-03-10)
2
6
 
3
7
  * Initial public release
data/README.md CHANGED
@@ -1,12 +1,10 @@
1
1
  # Sequel::CountComparisons
2
2
 
3
- This gem adds five methods to `Sequel::Dataset`:
3
+ This gem adds three methods to `Sequel::Dataset`:
4
4
 
5
5
  * `#count_equals?`
6
- * `#count_greater_than?`
7
6
  * `#count_less_than?`
8
- * `#count_at_most?`
9
- * `#count_at_least?`
7
+ * `#count_greater_than?`
10
8
 
11
9
  These methods allow you to efficiently compare a dataset's row count to a given number.
12
10
 
@@ -45,6 +43,9 @@ DB.extension(:count_comparisons)
45
43
  DB[:table].count_equals?(1)
46
44
  # SELECT EXISTS (SELECT 1 FROM table OFFSET 0) AND NOT EXISTS (SELECT 1 FROM table OFFSET 1)
47
45
 
46
+ DB[:table].count_equals?(0)
47
+ # SELECT 1 FROM table LIMIT 1
48
+
48
49
  DB[:table].count_greater_than?(0)
49
50
  # SELECT 1 FROM table LIMIT 1
50
51
 
@@ -57,12 +58,6 @@ DB[:table].count_less_than?(1)
57
58
  DB[:table].count_less_than?(5)
58
59
  # SELECT 1 FROM table LIMIT 1 OFFSET 4
59
60
 
60
- DB[:table].count_at_least?(3)
61
- # SELECT 1 FROM table LIMIT 1 OFFSET 2
62
-
63
- DB[:table].count_at_most?(100)
64
- # SELECT 1 FROM table LIMIT 1 OFFSET 100
65
-
66
61
  ```
67
62
 
68
63
  ## Caveats
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Sequel
4
4
  module CountComparisons
5
- VERSION = '1.0.0'
5
+ VERSION = '2.0.0'
6
6
  end
7
7
  end
@@ -3,8 +3,8 @@
3
3
  require 'sequel'
4
4
  require_relative '../count_comparisons/version'
5
5
 
6
- # The count_comparisons extension adds the #count_greater_than?, #count_less_than?, #count_at_most?,
7
- # #count_at_least?, and #count_equals? methods to Dataset. These methods can be used to efficiently
6
+ # The count_comparisons extension adds the #count_greater_than?, #count_less_than?
7
+ # and #count_equals? methods to Dataset. These methods can be used to efficiently
8
8
  # compare a dataset's row count to a given number.
9
9
 
10
10
  # You can load this extension into specific datasets:
@@ -60,33 +60,6 @@ module Sequel
60
60
  !count_greater_than?(number_of_rows - 1)
61
61
  end
62
62
 
63
- # Returns true if at least *number_of_rows* records exist in the dataset, false otherwise
64
- #
65
- # Equivalent to a "greater than or equal to" (>=) comparison
66
- #
67
- # @param number_of_rows [Integer] The number to compare against
68
- # @return [Boolean] Whether the dataset contains at least *number_of_rows*
69
- # @raise [ArgumentError] If `number_of_rows` is not an integer
70
- def count_at_least?(number_of_rows)
71
- unless number_of_rows.is_a?(Integer)
72
- raise ArgumentError,
73
- "`number_of_rows` must be an Integer, got #{number_of_rows.inspect}"
74
- end
75
-
76
- count_greater_than?(number_of_rows - 1)
77
- end
78
-
79
- # Returns true if at most *number_of_rows* records exist in the dataset, false otherwise
80
- #
81
- # Equivalent to a "less than or equal to" (<=) comparison
82
- #
83
- # @param number_of_rows [Integer] The number to compare against
84
- # @return [Boolean] Whether the dataset contains at most *number_of_rows*
85
- # @raise [ArgumentError] If `number_of_rows` is not an integer
86
- def count_at_most?(number_of_rows)
87
- !count_greater_than?(number_of_rows)
88
- end
89
-
90
63
  # Returns true if exactly *number_of_rows* records exist in the dataset, false otherwise
91
64
  #
92
65
  # Equivalent to an "equal to" (==) comparison
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequel_count_comparisons
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - eriklovmo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-03-10 00:00:00.000000000 Z
11
+ date: 2025-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sequel
@@ -88,6 +88,5 @@ requirements: []
88
88
  rubygems_version: 3.5.16
89
89
  signing_key:
90
90
  specification_version: 4
91
- summary: 'Adds #count_equals?, #count_greater_than?, #count_less_than?, #count_at_least?
92
- and #count_at_most? to Sequel::Dataset'
91
+ summary: 'Adds #count_less_than?, #count_equals? and #count_greater_than? to Sequel::Dataset'
93
92
  test_files: []