activerecord-yugabytedb-adapter 7.0.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +7 -0
  2. data/.rubocop.yml +13 -0
  3. data/CHANGELOG.md +5 -0
  4. data/CODE_OF_CONDUCT.md +84 -0
  5. data/Gemfile +10 -0
  6. data/Gemfile.lock +67 -0
  7. data/README.md +31 -0
  8. data/Rakefile +8 -0
  9. data/activerecord-yugabytedb-adapter.gemspec +39 -0
  10. data/lib/active_record/connection_adapters/yugabytedb/column.rb +69 -0
  11. data/lib/active_record/connection_adapters/yugabytedb/database_statements.rb +156 -0
  12. data/lib/active_record/connection_adapters/yugabytedb/database_tasks.rb +19 -0
  13. data/lib/active_record/connection_adapters/yugabytedb/explain_pretty_printer.rb +44 -0
  14. data/lib/active_record/connection_adapters/yugabytedb/oid/array.rb +91 -0
  15. data/lib/active_record/connection_adapters/yugabytedb/oid/bit.rb +53 -0
  16. data/lib/active_record/connection_adapters/yugabytedb/oid/bit_varying.rb +15 -0
  17. data/lib/active_record/connection_adapters/yugabytedb/oid/bytea.rb +17 -0
  18. data/lib/active_record/connection_adapters/yugabytedb/oid/cidr.rb +48 -0
  19. data/lib/active_record/connection_adapters/yugabytedb/oid/date.rb +31 -0
  20. data/lib/active_record/connection_adapters/yugabytedb/oid/date_time.rb +36 -0
  21. data/lib/active_record/connection_adapters/yugabytedb/oid/decimal.rb +15 -0
  22. data/lib/active_record/connection_adapters/yugabytedb/oid/enum.rb +20 -0
  23. data/lib/active_record/connection_adapters/yugabytedb/oid/hstore.rb +109 -0
  24. data/lib/active_record/connection_adapters/yugabytedb/oid/inet.rb +15 -0
  25. data/lib/active_record/connection_adapters/yugabytedb/oid/interval.rb +49 -0
  26. data/lib/active_record/connection_adapters/yugabytedb/oid/jsonb.rb +15 -0
  27. data/lib/active_record/connection_adapters/yugabytedb/oid/legacy_point.rb +44 -0
  28. data/lib/active_record/connection_adapters/yugabytedb/oid/macaddr.rb +25 -0
  29. data/lib/active_record/connection_adapters/yugabytedb/oid/money.rb +41 -0
  30. data/lib/active_record/connection_adapters/yugabytedb/oid/oid.rb +15 -0
  31. data/lib/active_record/connection_adapters/yugabytedb/oid/point.rb +64 -0
  32. data/lib/active_record/connection_adapters/yugabytedb/oid/range.rb +115 -0
  33. data/lib/active_record/connection_adapters/yugabytedb/oid/specialized_string.rb +18 -0
  34. data/lib/active_record/connection_adapters/yugabytedb/oid/timestamp.rb +15 -0
  35. data/lib/active_record/connection_adapters/yugabytedb/oid/timestamp_with_time_zone.rb +30 -0
  36. data/lib/active_record/connection_adapters/yugabytedb/oid/type_map_initializer.rb +125 -0
  37. data/lib/active_record/connection_adapters/yugabytedb/oid/uuid.rb +35 -0
  38. data/lib/active_record/connection_adapters/yugabytedb/oid/vector.rb +28 -0
  39. data/lib/active_record/connection_adapters/yugabytedb/oid/xml.rb +30 -0
  40. data/lib/active_record/connection_adapters/yugabytedb/oid.rb +38 -0
  41. data/lib/active_record/connection_adapters/yugabytedb/quoting.rb +205 -0
  42. data/lib/active_record/connection_adapters/yugabytedb/referential_integrity.rb +77 -0
  43. data/lib/active_record/connection_adapters/yugabytedb/schema_creation.rb +100 -0
  44. data/lib/active_record/connection_adapters/yugabytedb/schema_definitions.rb +243 -0
  45. data/lib/active_record/connection_adapters/yugabytedb/schema_dumper.rb +74 -0
  46. data/lib/active_record/connection_adapters/yugabytedb/schema_statements.rb +812 -0
  47. data/lib/active_record/connection_adapters/yugabytedb/type_metadata.rb +44 -0
  48. data/lib/active_record/connection_adapters/yugabytedb/utils.rb +80 -0
  49. data/lib/active_record/connection_adapters/yugabytedb_adapter.rb +1069 -0
  50. data/lib/activerecord-yugabytedb-adapter.rb +11 -0
  51. data/lib/arel/visitors/yugabytedb.rb +99 -0
  52. data/lib/version.rb +5 -0
  53. data/sig/activerecord-yugabytedb-adapter.rbs +4 -0
  54. metadata +124 -0
@@ -0,0 +1,11 @@
1
+ if defined?(Rails::Railtie)
2
+ module ActiveRecord
3
+ module ConnectionAdapters
4
+ class YugabyteDBRailtie < ::Rails::Railtie
5
+ rake_tasks do
6
+ load "active_record/connection_adapters/yugabytedb/database_tasks.rb"
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,99 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Arel # :nodoc: all
4
+ module Visitors
5
+ class YugabyteDB < Arel::Visitors::ToSql
6
+ private
7
+ def visit_Arel_Nodes_Matches(o, collector)
8
+ op = o.case_sensitive ? " LIKE " : " ILIKE "
9
+ collector = infix_value o, collector, op
10
+ if o.escape
11
+ collector << " ESCAPE "
12
+ visit o.escape, collector
13
+ else
14
+ collector
15
+ end
16
+ end
17
+
18
+ def visit_Arel_Nodes_DoesNotMatch(o, collector)
19
+ op = o.case_sensitive ? " NOT LIKE " : " NOT ILIKE "
20
+ collector = infix_value o, collector, op
21
+ if o.escape
22
+ collector << " ESCAPE "
23
+ visit o.escape, collector
24
+ else
25
+ collector
26
+ end
27
+ end
28
+
29
+ def visit_Arel_Nodes_Regexp(o, collector)
30
+ op = o.case_sensitive ? " ~ " : " ~* "
31
+ infix_value o, collector, op
32
+ end
33
+
34
+ def visit_Arel_Nodes_NotRegexp(o, collector)
35
+ op = o.case_sensitive ? " !~ " : " !~* "
36
+ infix_value o, collector, op
37
+ end
38
+
39
+ def visit_Arel_Nodes_DistinctOn(o, collector)
40
+ collector << "DISTINCT ON ( "
41
+ visit(o.expr, collector) << " )"
42
+ end
43
+
44
+ def visit_Arel_Nodes_GroupingElement(o, collector)
45
+ collector << "( "
46
+ visit(o.expr, collector) << " )"
47
+ end
48
+
49
+ def visit_Arel_Nodes_Cube(o, collector)
50
+ collector << "CUBE"
51
+ grouping_array_or_grouping_element o, collector
52
+ end
53
+
54
+ def visit_Arel_Nodes_RollUp(o, collector)
55
+ collector << "ROLLUP"
56
+ grouping_array_or_grouping_element o, collector
57
+ end
58
+
59
+ def visit_Arel_Nodes_GroupingSet(o, collector)
60
+ collector << "GROUPING SETS"
61
+ grouping_array_or_grouping_element o, collector
62
+ end
63
+
64
+ def visit_Arel_Nodes_Lateral(o, collector)
65
+ collector << "LATERAL "
66
+ grouping_parentheses o.expr, collector
67
+ end
68
+
69
+ def visit_Arel_Nodes_IsNotDistinctFrom(o, collector)
70
+ collector = visit o.left, collector
71
+ collector << " IS NOT DISTINCT FROM "
72
+ visit o.right, collector
73
+ end
74
+
75
+ def visit_Arel_Nodes_IsDistinctFrom(o, collector)
76
+ collector = visit o.left, collector
77
+ collector << " IS DISTINCT FROM "
78
+ visit o.right, collector
79
+ end
80
+
81
+ BIND_BLOCK = proc { |i| "$#{i}" }
82
+ private_constant :BIND_BLOCK
83
+
84
+ def bind_block; BIND_BLOCK; end
85
+
86
+ # Utilized by GroupingSet, Cube & RollUp visitors to
87
+ # handle grouping aggregation semantics
88
+ def grouping_array_or_grouping_element(o, collector)
89
+ if o.expr.is_a? Array
90
+ collector << "( "
91
+ visit o.expr, collector
92
+ collector << " )"
93
+ else
94
+ visit o.expr, collector
95
+ end
96
+ end
97
+ end
98
+ end
99
+ end
data/lib/version.rb ADDED
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActiveRecord
4
+ YUGABYTE_DB_ADAPTER_VERSION = "7.0.4.1"
5
+ end
@@ -0,0 +1,4 @@
1
+ module ActiverecordYugabytedbAdapter
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,124 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: activerecord-yugabytedb-adapter
3
+ version: !ruby/object:Gem::Version
4
+ version: 7.0.4.1
5
+ platform: ruby
6
+ authors:
7
+ - YugabyteDB Development Team
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2024-06-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activerecord
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 7.0.4
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 7.0.4
27
+ - !ruby/object:Gem::Dependency
28
+ name: yugabyte_ysql
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.3'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.3'
41
+ description: YugabyteDB adapter for ActiveRecord.
42
+ email:
43
+ - info@yugabyte.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".rubocop.yml"
49
+ - CHANGELOG.md
50
+ - CODE_OF_CONDUCT.md
51
+ - Gemfile
52
+ - Gemfile.lock
53
+ - README.md
54
+ - Rakefile
55
+ - activerecord-yugabytedb-adapter.gemspec
56
+ - lib/active_record/connection_adapters/yugabytedb/column.rb
57
+ - lib/active_record/connection_adapters/yugabytedb/database_statements.rb
58
+ - lib/active_record/connection_adapters/yugabytedb/database_tasks.rb
59
+ - lib/active_record/connection_adapters/yugabytedb/explain_pretty_printer.rb
60
+ - lib/active_record/connection_adapters/yugabytedb/oid.rb
61
+ - lib/active_record/connection_adapters/yugabytedb/oid/array.rb
62
+ - lib/active_record/connection_adapters/yugabytedb/oid/bit.rb
63
+ - lib/active_record/connection_adapters/yugabytedb/oid/bit_varying.rb
64
+ - lib/active_record/connection_adapters/yugabytedb/oid/bytea.rb
65
+ - lib/active_record/connection_adapters/yugabytedb/oid/cidr.rb
66
+ - lib/active_record/connection_adapters/yugabytedb/oid/date.rb
67
+ - lib/active_record/connection_adapters/yugabytedb/oid/date_time.rb
68
+ - lib/active_record/connection_adapters/yugabytedb/oid/decimal.rb
69
+ - lib/active_record/connection_adapters/yugabytedb/oid/enum.rb
70
+ - lib/active_record/connection_adapters/yugabytedb/oid/hstore.rb
71
+ - lib/active_record/connection_adapters/yugabytedb/oid/inet.rb
72
+ - lib/active_record/connection_adapters/yugabytedb/oid/interval.rb
73
+ - lib/active_record/connection_adapters/yugabytedb/oid/jsonb.rb
74
+ - lib/active_record/connection_adapters/yugabytedb/oid/legacy_point.rb
75
+ - lib/active_record/connection_adapters/yugabytedb/oid/macaddr.rb
76
+ - lib/active_record/connection_adapters/yugabytedb/oid/money.rb
77
+ - lib/active_record/connection_adapters/yugabytedb/oid/oid.rb
78
+ - lib/active_record/connection_adapters/yugabytedb/oid/point.rb
79
+ - lib/active_record/connection_adapters/yugabytedb/oid/range.rb
80
+ - lib/active_record/connection_adapters/yugabytedb/oid/specialized_string.rb
81
+ - lib/active_record/connection_adapters/yugabytedb/oid/timestamp.rb
82
+ - lib/active_record/connection_adapters/yugabytedb/oid/timestamp_with_time_zone.rb
83
+ - lib/active_record/connection_adapters/yugabytedb/oid/type_map_initializer.rb
84
+ - lib/active_record/connection_adapters/yugabytedb/oid/uuid.rb
85
+ - lib/active_record/connection_adapters/yugabytedb/oid/vector.rb
86
+ - lib/active_record/connection_adapters/yugabytedb/oid/xml.rb
87
+ - lib/active_record/connection_adapters/yugabytedb/quoting.rb
88
+ - lib/active_record/connection_adapters/yugabytedb/referential_integrity.rb
89
+ - lib/active_record/connection_adapters/yugabytedb/schema_creation.rb
90
+ - lib/active_record/connection_adapters/yugabytedb/schema_definitions.rb
91
+ - lib/active_record/connection_adapters/yugabytedb/schema_dumper.rb
92
+ - lib/active_record/connection_adapters/yugabytedb/schema_statements.rb
93
+ - lib/active_record/connection_adapters/yugabytedb/type_metadata.rb
94
+ - lib/active_record/connection_adapters/yugabytedb/utils.rb
95
+ - lib/active_record/connection_adapters/yugabytedb_adapter.rb
96
+ - lib/activerecord-yugabytedb-adapter.rb
97
+ - lib/arel/visitors/yugabytedb.rb
98
+ - lib/version.rb
99
+ - sig/activerecord-yugabytedb-adapter.rbs
100
+ homepage: https://docs.yugabyte.com/preview/drivers-orms/ruby/activerecord/
101
+ licenses: []
102
+ metadata:
103
+ homepage_uri: https://docs.yugabyte.com/preview/drivers-orms/ruby/activerecord/
104
+ source_code_uri: https://github.com/yugabyte/activerecord-yugabytedb-adapter
105
+ post_install_message:
106
+ rdoc_options: []
107
+ require_paths:
108
+ - lib
109
+ required_ruby_version: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - ">="
112
+ - !ruby/object:Gem::Version
113
+ version: 2.6.0
114
+ required_rubygems_version: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ requirements: []
120
+ rubygems_version: 3.3.27
121
+ signing_key:
122
+ specification_version: 4
123
+ summary: YugabyteDB adapter for ActiveRecord.
124
+ test_files: []