bzync-nextsql 0.1.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 +7 -0
- data/LICENSE +21 -0
- data/README.md +37 -0
- data/lib/nextsql/client.rb +595 -0
- data/lib/nextsql/cluster.rb +190 -0
- data/lib/nextsql/errors.rb +18 -0
- data/lib/nextsql/protocol.rb +1126 -0
- data/lib/nextsql/version.rb +5 -0
- data/lib/nextsql.rb +68 -0
- metadata +53 -0
data/lib/nextsql.rb
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Official NextSQL Ruby driver. Speaks the native NSQL v1 protocol.
|
|
4
|
+
#
|
|
5
|
+
# require "nextsql"
|
|
6
|
+
#
|
|
7
|
+
# conn = NextSQL.connect(NextSQL::Config.new(
|
|
8
|
+
# address: "db.example.com:7210",
|
|
9
|
+
# database: "production",
|
|
10
|
+
# user: "app",
|
|
11
|
+
# password: "s3cret",
|
|
12
|
+
# tls: NextSQL::TLSConfig.new,
|
|
13
|
+
# ))
|
|
14
|
+
# begin
|
|
15
|
+
# result = conn.exec("SELECT id, name FROM users WHERE id = $1", [1])
|
|
16
|
+
# result.rows.each { |row| puts row.inspect }
|
|
17
|
+
# ensure
|
|
18
|
+
# conn.close
|
|
19
|
+
# end
|
|
20
|
+
#
|
|
21
|
+
# Published to RubyGems as +bzync-nextsql+ (+gem install bzync-nextsql+, then
|
|
22
|
+
# +require "nextsql"+). Zero runtime dependencies. It can also be required
|
|
23
|
+
# straight from this tree with +drivers/ruby/lib+ on +$LOAD_PATH+.
|
|
24
|
+
|
|
25
|
+
require_relative "nextsql/version"
|
|
26
|
+
require_relative "nextsql/errors"
|
|
27
|
+
require_relative "nextsql/protocol"
|
|
28
|
+
require_relative "nextsql/client"
|
|
29
|
+
require_relative "nextsql/cluster"
|
|
30
|
+
|
|
31
|
+
module NextSQL
|
|
32
|
+
READ_STRONG = Protocol::READ_STRONG
|
|
33
|
+
READ_BOUNDED = Protocol::READ_BOUNDED
|
|
34
|
+
READ_STALE = Protocol::READ_STALE
|
|
35
|
+
|
|
36
|
+
Vector = Protocol::Vector
|
|
37
|
+
Point = Protocol::Point
|
|
38
|
+
Box = Protocol::Box
|
|
39
|
+
Line = Protocol::Line
|
|
40
|
+
Polygon = Protocol::Polygon
|
|
41
|
+
NodeStatus = Protocol::NodeStatus
|
|
42
|
+
Int8 = Protocol::Int8
|
|
43
|
+
Int16 = Protocol::Int16
|
|
44
|
+
Int32 = Protocol::Int32
|
|
45
|
+
Int64 = Protocol::Int64
|
|
46
|
+
Uint8 = Protocol::Uint8
|
|
47
|
+
Uint16 = Protocol::Uint16
|
|
48
|
+
Uint32 = Protocol::Uint32
|
|
49
|
+
Uint64 = Protocol::Uint64
|
|
50
|
+
EnumValue = Protocol::EnumValue
|
|
51
|
+
NaiveTimestamp = Protocol::NaiveTimestamp
|
|
52
|
+
TimeOfDay = Protocol::TimeOfDay
|
|
53
|
+
Float32 = Protocol::Float32
|
|
54
|
+
Float64 = Protocol::Float64
|
|
55
|
+
Interval = Protocol::Interval
|
|
56
|
+
|
|
57
|
+
# Opens one connection to a single node. For an HA cluster with
|
|
58
|
+
# leader-failover and follower-read routing, use ::connect_cluster.
|
|
59
|
+
def self.connect(cfg)
|
|
60
|
+
Connection.connect(cfg)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# Opens a routing client over every node in +cfg.nodes+ (or the single
|
|
64
|
+
# +cfg.address+). See Cluster for routing behavior.
|
|
65
|
+
def self.connect_cluster(cfg)
|
|
66
|
+
Cluster.connect(cfg)
|
|
67
|
+
end
|
|
68
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: bzync-nextsql
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Rayan Reynaldo
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies: []
|
|
12
|
+
description: 'Native-protocol client for NextSQL: TLS 1.3, prepared statements, follower-read
|
|
13
|
+
routing, and NSCE1 client-side field encryption. Keys and passwords are never accepted
|
|
14
|
+
in a URL.'
|
|
15
|
+
executables: []
|
|
16
|
+
extensions: []
|
|
17
|
+
extra_rdoc_files: []
|
|
18
|
+
files:
|
|
19
|
+
- LICENSE
|
|
20
|
+
- README.md
|
|
21
|
+
- lib/nextsql.rb
|
|
22
|
+
- lib/nextsql/client.rb
|
|
23
|
+
- lib/nextsql/cluster.rb
|
|
24
|
+
- lib/nextsql/errors.rb
|
|
25
|
+
- lib/nextsql/protocol.rb
|
|
26
|
+
- lib/nextsql/version.rb
|
|
27
|
+
homepage: https://nextsql.bzync.com/docs/drivers
|
|
28
|
+
licenses:
|
|
29
|
+
- MIT
|
|
30
|
+
metadata:
|
|
31
|
+
homepage_uri: https://nextsql.bzync.com/docs/drivers
|
|
32
|
+
source_code_uri: https://github.com/bzync/nextsql/tree/master/drivers/ruby
|
|
33
|
+
bug_tracker_uri: https://github.com/bzync/nextsql/issues
|
|
34
|
+
changelog_uri: https://github.com/bzync/nextsql/blob/master/CHANGELOG.md
|
|
35
|
+
rubygems_mfa_required: 'true'
|
|
36
|
+
rdoc_options: []
|
|
37
|
+
require_paths:
|
|
38
|
+
- lib
|
|
39
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
40
|
+
requirements:
|
|
41
|
+
- - ">="
|
|
42
|
+
- !ruby/object:Gem::Version
|
|
43
|
+
version: '3.0'
|
|
44
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
45
|
+
requirements:
|
|
46
|
+
- - ">="
|
|
47
|
+
- !ruby/object:Gem::Version
|
|
48
|
+
version: '0'
|
|
49
|
+
requirements: []
|
|
50
|
+
rubygems_version: 4.0.20
|
|
51
|
+
specification_version: 4
|
|
52
|
+
summary: Official NextSQL Ruby driver. Speaks the native NSQL v1 protocol.
|
|
53
|
+
test_files: []
|