esql 0.1.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3d0ec66abeb7fa4a711ecc8c7a73be80099c12f3b3211f4814e8e756ab3e1316
4
- data.tar.gz: d417589cec6723ff1f8e383a4e00c472766634a654f0f537cee66b75fad39f97
3
+ metadata.gz: 9d9c585a99213519841d4d931eece38fdafdfd5630c97061720faa2bd8bcbeee
4
+ data.tar.gz: 31cd360fa758a6a2892319cc5ffdb2f7dcf34c83665350a646af9b706dcaa768
5
5
  SHA512:
6
- metadata.gz: ba188083f0290e75860dc3ba2dcfa2bcd1176b7826f570bf8dbba308b75aabedb9490bc730904b6d79e943d03600780bc7e12162e548c2307d2a4df0297d8f73
7
- data.tar.gz: 2e039c4b8baa125b3a6412a3a780cee6eb9bebb26a4e44239889f5541c554aa6a85ee4f0254f5864612f927e8b039d16b74ffd24509bb3a6f64a0fc0ce119936
6
+ metadata.gz: 65a4182cfb152f5ecebbddc622317458bcf15561e9d2bf68ed705cb7907f8073c1e6e125f86aec65877dcf90a9ce4e9726d3beba91a6be3314fa09cff3a08423
7
+ data.tar.gz: 9b6afb34fbfd9559ac06ed1f59c98245a48e6dfb15decd5c745701a465261e1840ad7f1ae989cf8e29728a4eb594f1a79ff9d812b4a5122146e9c94655d03306
@@ -1,6 +1,15 @@
1
1
  ---
2
2
  language: ruby
3
- cache: bundler
4
3
  rvm:
5
4
  - 2.6.0
5
+ before_script:
6
+ - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
7
+ - chmod +x ./cc-test-reporter
8
+ - ./cc-test-reporter before-build
9
+ script:
10
+ - bundle exec rspec
11
+ after_script:
12
+ - ./cc-test-reporter after-build -t simplecov --exit-code $TRAVIS_TEST_RESULT
6
13
  before_install: gem install bundler -v 2.1.4
14
+ install:
15
+ - bundle
data/Gemfile CHANGED
@@ -1,3 +1,7 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
+
5
+ group :development, :test do
6
+ gem 'simplecov', '~> 0.17.1'
7
+ end
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # esql
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/esql.svg)](https://badge.fury.io/rb/esql) [![Build Status](https://travis-ci.org/paulholden2/esql.svg?branch=master)](https://travis-ci.org/paulholden2/esql) [![Inline docs](http://inch-ci.org/github/paulholden2/esql.svg?branch=master)](http://inch-ci.org/github/paulholden2/esql)
4
+
3
5
  Esql is a library for ActiveRecord scoping using simple expressions.
4
6
 
5
7
  ## Installation
@@ -90,17 +92,41 @@ Errors that get past this simple check layer (like type mismatches or even
90
92
  query runtime errors) will bubble up as ActiveRecord exceptions that you'll
91
93
  have to handle yourself.
92
94
 
93
- ## Development
95
+ ### Operators
96
+
97
+ * Arithmetic
98
+ * Multiplication: *
99
+ * Division: /
100
+ * Addition: +
101
+ * Subtraction: -
102
+ * Logical
103
+ * Less than: <
104
+ * Less than or equal: <=
105
+ * Greater than: >
106
+ * Greater than or equal: >=
107
+
108
+ ### Attributes
109
+
110
+ Attributes are referenced using the column name, e.g. `first_name`. Note that
111
+ the attribute must exist on the model in your scope, otherwise an error will
112
+ be raised.
113
+
114
+ ### Related attributes
115
+
116
+ You can use values on related records using the dot operator, e.g.
117
+ `employee.first_name`. This essentially calls `joins` on your scope with the
118
+ given relationship, as long as it is valid. The attribute must exist on the
119
+ related model, otherwise an error will be raised.
120
+
121
+ ### Related aggregates
122
+
123
+ You can retrieve aggregates on related records, also using the dot operator,
124
+ e.g. `employees.count`. This `joins` a subquery, so keep that in mind.
94
125
 
95
- After checking out the repo, run `bin/setup` to install dependencies. Then,
96
- run `rake spec` to run the tests. You can also run `bin/console` for an
97
- interactive prompt that will allow you to experiment.
126
+ ### Functions
98
127
 
99
- To install this gem onto your local machine, run `bundle exec rake install`.
100
- To release a new version, update the version number in `version.rb`, and then
101
- run `bundle exec rake release`, which will create a git tag for the version,
102
- push git commits and tags, and push the `.gem` file to
103
- [rubygems.org](https://rubygems.org).
128
+ * String functions:
129
+ * concat(arg1, arg2, ...)
104
130
 
105
131
  ## Contributing
106
132
 
@@ -33,5 +33,4 @@ Gem::Specification.new do |spec|
33
33
  spec.add_development_dependency 'rspec', '~> 3.0'
34
34
  spec.add_development_dependency 'sqlite3'
35
35
  spec.add_development_dependency 'factory_bot'
36
- spec.add_development_dependency 'simplecov'
37
36
  end
@@ -35,7 +35,6 @@ module Esql
35
35
  :function,
36
36
  :string,
37
37
  :number,
38
- :boolean,
39
38
  :related_count,
40
39
  :related_attribute,
41
40
  :attribute
@@ -133,11 +132,5 @@ module Esql
133
132
  return scope, self.text
134
133
  end
135
134
  end
136
-
137
- rule :boolean, /(true|false)/ do
138
- def evaluate(scope)
139
- return scope, self.text
140
- end
141
- end
142
135
  end
143
136
  end
@@ -1,3 +1,3 @@
1
1
  module Esql
2
- VERSION = '0.1.0'
2
+ VERSION = '1.0.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: esql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Holden
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-09-21 00:00:00.000000000 Z
11
+ date: 2020-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -94,20 +94,6 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: simplecov
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
97
  description: A library for ActiveRecord scoping using simple expressions.
112
98
  email:
113
99
  - paul@codelunker.com