influxdb-arel 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +22 -0
  3. data/.rspec +3 -0
  4. data/.travis.yml +8 -0
  5. data/Gemfile +6 -0
  6. data/LICENSE.txt +22 -0
  7. data/README.md +350 -0
  8. data/Rakefile +6 -0
  9. data/influxdb-arel.gemspec +24 -0
  10. data/lib/influxdb-arel.rb +1 -0
  11. data/lib/influxdb.rb +4 -0
  12. data/lib/influxdb/arel.rb +38 -0
  13. data/lib/influxdb/arel/alias_predication.rb +9 -0
  14. data/lib/influxdb/arel/attributes.rb +1 -0
  15. data/lib/influxdb/arel/attributes/attribute.rb +74 -0
  16. data/lib/influxdb/arel/core_extensions.rb +49 -0
  17. data/lib/influxdb/arel/expressions.rb +73 -0
  18. data/lib/influxdb/arel/math.rb +21 -0
  19. data/lib/influxdb/arel/nodes.rb +27 -0
  20. data/lib/influxdb/arel/nodes/and.rb +32 -0
  21. data/lib/influxdb/arel/nodes/binary.rb +47 -0
  22. data/lib/influxdb/arel/nodes/duration.rb +30 -0
  23. data/lib/influxdb/arel/nodes/equality.rb +11 -0
  24. data/lib/influxdb/arel/nodes/function.rb +47 -0
  25. data/lib/influxdb/arel/nodes/grouping.rb +11 -0
  26. data/lib/influxdb/arel/nodes/in.rb +8 -0
  27. data/lib/influxdb/arel/nodes/infix_operation.rb +51 -0
  28. data/lib/influxdb/arel/nodes/node.rb +19 -0
  29. data/lib/influxdb/arel/nodes/now.rb +15 -0
  30. data/lib/influxdb/arel/nodes/select_statement.rb +59 -0
  31. data/lib/influxdb/arel/nodes/sql_literal.rb +23 -0
  32. data/lib/influxdb/arel/nodes/table_alias.rb +23 -0
  33. data/lib/influxdb/arel/nodes/time.rb +13 -0
  34. data/lib/influxdb/arel/nodes/unary.rb +35 -0
  35. data/lib/influxdb/arel/predications.rb +137 -0
  36. data/lib/influxdb/arel/select_manager.rb +129 -0
  37. data/lib/influxdb/arel/table.rb +219 -0
  38. data/lib/influxdb/arel/tree_manager.rb +30 -0
  39. data/lib/influxdb/arel/version.rb +5 -0
  40. data/lib/influxdb/arel/visitor.rb +287 -0
  41. data/spec/lib/influxdb/arel/core_extensions_spec.rb +49 -0
  42. data/spec/lib/influxdb/arel/nodes/and_spec.rb +17 -0
  43. data/spec/lib/influxdb/arel/nodes/binary_spec.rb +49 -0
  44. data/spec/lib/influxdb/arel/nodes/duration_spec.rb +72 -0
  45. data/spec/lib/influxdb/arel/nodes/equality_spec.rb +5 -0
  46. data/spec/lib/influxdb/arel/nodes/function_spec.rb +69 -0
  47. data/spec/lib/influxdb/arel/nodes/grouping_spec.rb +10 -0
  48. data/spec/lib/influxdb/arel/nodes/in_spec.rb +13 -0
  49. data/spec/lib/influxdb/arel/nodes/now_spec.rb +8 -0
  50. data/spec/lib/influxdb/arel/nodes/sql_literal_spec.rb +28 -0
  51. data/spec/lib/influxdb/arel/nodes/table_alias_spec.rb +36 -0
  52. data/spec/lib/influxdb/arel/nodes/time_spec.rb +5 -0
  53. data/spec/lib/influxdb/arel/nodes/unary_spec.rb +25 -0
  54. data/spec/lib/influxdb/arel/select_manager_spec.rb +459 -0
  55. data/spec/lib/influxdb/arel/table_spec.rb +193 -0
  56. data/spec/lib/influxdb/arel_spec.rb +11 -0
  57. data/spec/spec_helper.rb +20 -0
  58. data/spec/support/examples/binary_node.rb +10 -0
  59. data/spec/support/examples/function_node.rb +14 -0
  60. data/spec/support/examples/node_as.rb +8 -0
  61. data/spec/support/examples/node_expressions.rb +145 -0
  62. data/spec/support/examples/node_math.rb +29 -0
  63. data/spec/support/examples/node_predications.rb +248 -0
  64. data/spec/support/examples/node_to_sql.rb +5 -0
  65. data/spec/support/examples/unary_node.rb +10 -0
  66. data/spec/support/fabrics.rb +21 -0
  67. metadata +177 -0
@@ -0,0 +1,5 @@
1
+ shared_examples_for :node_to_sql do |node_sql|
2
+ describe '#to_sql' do
3
+ specify{ expect(described_node.to_sql).to eq(node_sql) }
4
+ end
5
+ end
@@ -0,0 +1,10 @@
1
+ shared_examples_for :unary_node do |klass, node_sql = nil|
2
+ let(:described_node){ node(klass, sql('value')) }
3
+
4
+ it_should_behave_like :node_to_sql, node_sql if node_sql
5
+
6
+ describe '#eql?' do
7
+ specify{ expect(described_node.eql?(node(klass, sql('value')))).to be_truthy }
8
+ specify{ expect(described_node.eql?(node(klass, sql('another value')))).to be_falsy }
9
+ end
10
+ end
@@ -0,0 +1,21 @@
1
+ module Influxdb
2
+ module Arel
3
+ module RspecHelper
4
+ def sql(value)
5
+ node('SqlLiteral', value)
6
+ end
7
+
8
+ def node(class_name, *args)
9
+ Influxdb::Arel::Nodes.const_get(class_name).new(*args)
10
+ end
11
+
12
+ def table(name)
13
+ Influxdb::Arel::Table.new(name)
14
+ end
15
+
16
+ def visitor
17
+ Influxdb::Arel::Visitor.new
18
+ end
19
+ end
20
+ end
21
+ end
metadata ADDED
@@ -0,0 +1,177 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: influxdb-arel
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - undr
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-10-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Influxdb::Arel is a SQL AST manager for Influxdb dialect.
56
+ email:
57
+ - undr@yandex.ru
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".rspec"
64
+ - ".travis.yml"
65
+ - Gemfile
66
+ - LICENSE.txt
67
+ - README.md
68
+ - Rakefile
69
+ - influxdb-arel.gemspec
70
+ - lib/influxdb-arel.rb
71
+ - lib/influxdb.rb
72
+ - lib/influxdb/arel.rb
73
+ - lib/influxdb/arel/alias_predication.rb
74
+ - lib/influxdb/arel/attributes.rb
75
+ - lib/influxdb/arel/attributes/attribute.rb
76
+ - lib/influxdb/arel/core_extensions.rb
77
+ - lib/influxdb/arel/expressions.rb
78
+ - lib/influxdb/arel/math.rb
79
+ - lib/influxdb/arel/nodes.rb
80
+ - lib/influxdb/arel/nodes/and.rb
81
+ - lib/influxdb/arel/nodes/binary.rb
82
+ - lib/influxdb/arel/nodes/duration.rb
83
+ - lib/influxdb/arel/nodes/equality.rb
84
+ - lib/influxdb/arel/nodes/function.rb
85
+ - lib/influxdb/arel/nodes/grouping.rb
86
+ - lib/influxdb/arel/nodes/in.rb
87
+ - lib/influxdb/arel/nodes/infix_operation.rb
88
+ - lib/influxdb/arel/nodes/node.rb
89
+ - lib/influxdb/arel/nodes/now.rb
90
+ - lib/influxdb/arel/nodes/select_statement.rb
91
+ - lib/influxdb/arel/nodes/sql_literal.rb
92
+ - lib/influxdb/arel/nodes/table_alias.rb
93
+ - lib/influxdb/arel/nodes/time.rb
94
+ - lib/influxdb/arel/nodes/unary.rb
95
+ - lib/influxdb/arel/predications.rb
96
+ - lib/influxdb/arel/select_manager.rb
97
+ - lib/influxdb/arel/table.rb
98
+ - lib/influxdb/arel/tree_manager.rb
99
+ - lib/influxdb/arel/version.rb
100
+ - lib/influxdb/arel/visitor.rb
101
+ - spec/lib/influxdb/arel/core_extensions_spec.rb
102
+ - spec/lib/influxdb/arel/nodes/and_spec.rb
103
+ - spec/lib/influxdb/arel/nodes/binary_spec.rb
104
+ - spec/lib/influxdb/arel/nodes/duration_spec.rb
105
+ - spec/lib/influxdb/arel/nodes/equality_spec.rb
106
+ - spec/lib/influxdb/arel/nodes/function_spec.rb
107
+ - spec/lib/influxdb/arel/nodes/grouping_spec.rb
108
+ - spec/lib/influxdb/arel/nodes/in_spec.rb
109
+ - spec/lib/influxdb/arel/nodes/now_spec.rb
110
+ - spec/lib/influxdb/arel/nodes/sql_literal_spec.rb
111
+ - spec/lib/influxdb/arel/nodes/table_alias_spec.rb
112
+ - spec/lib/influxdb/arel/nodes/time_spec.rb
113
+ - spec/lib/influxdb/arel/nodes/unary_spec.rb
114
+ - spec/lib/influxdb/arel/select_manager_spec.rb
115
+ - spec/lib/influxdb/arel/table_spec.rb
116
+ - spec/lib/influxdb/arel_spec.rb
117
+ - spec/spec_helper.rb
118
+ - spec/support/examples/binary_node.rb
119
+ - spec/support/examples/function_node.rb
120
+ - spec/support/examples/node_as.rb
121
+ - spec/support/examples/node_expressions.rb
122
+ - spec/support/examples/node_math.rb
123
+ - spec/support/examples/node_predications.rb
124
+ - spec/support/examples/node_to_sql.rb
125
+ - spec/support/examples/unary_node.rb
126
+ - spec/support/fabrics.rb
127
+ homepage: https://github.com/undr/influxdb-arel
128
+ licenses:
129
+ - MIT
130
+ metadata: {}
131
+ post_install_message:
132
+ rdoc_options: []
133
+ require_paths:
134
+ - lib
135
+ required_ruby_version: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
140
+ required_rubygems_version: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ version: '0'
145
+ requirements: []
146
+ rubyforge_project:
147
+ rubygems_version: 2.2.2
148
+ signing_key:
149
+ specification_version: 4
150
+ summary: Influxdb SQL AST manager.
151
+ test_files:
152
+ - spec/lib/influxdb/arel/core_extensions_spec.rb
153
+ - spec/lib/influxdb/arel/nodes/and_spec.rb
154
+ - spec/lib/influxdb/arel/nodes/binary_spec.rb
155
+ - spec/lib/influxdb/arel/nodes/duration_spec.rb
156
+ - spec/lib/influxdb/arel/nodes/equality_spec.rb
157
+ - spec/lib/influxdb/arel/nodes/function_spec.rb
158
+ - spec/lib/influxdb/arel/nodes/grouping_spec.rb
159
+ - spec/lib/influxdb/arel/nodes/in_spec.rb
160
+ - spec/lib/influxdb/arel/nodes/now_spec.rb
161
+ - spec/lib/influxdb/arel/nodes/sql_literal_spec.rb
162
+ - spec/lib/influxdb/arel/nodes/table_alias_spec.rb
163
+ - spec/lib/influxdb/arel/nodes/time_spec.rb
164
+ - spec/lib/influxdb/arel/nodes/unary_spec.rb
165
+ - spec/lib/influxdb/arel/select_manager_spec.rb
166
+ - spec/lib/influxdb/arel/table_spec.rb
167
+ - spec/lib/influxdb/arel_spec.rb
168
+ - spec/spec_helper.rb
169
+ - spec/support/examples/binary_node.rb
170
+ - spec/support/examples/function_node.rb
171
+ - spec/support/examples/node_as.rb
172
+ - spec/support/examples/node_expressions.rb
173
+ - spec/support/examples/node_math.rb
174
+ - spec/support/examples/node_predications.rb
175
+ - spec/support/examples/node_to_sql.rb
176
+ - spec/support/examples/unary_node.rb
177
+ - spec/support/fabrics.rb