File tree 5 files changed +30
-5
lines changed
5 files changed +30
-5
lines changed Original file line number Diff line number Diff line change 1
- DB="couchbase://localhost:8093"
2
- VSQL="select version() as version;"
1
+ # NOTE: this will only work after setting up a database on http://localhost:8091/
2
+ DB="couchbase://Administrator:P4ssw0rd@localhost"
3
+ VSQL="select raw ds_version() as version;"
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ postgres:*:*:*:postgres:P4ssw0rd
6
6
7
7
cql:*:*:*:cassandra:cassandra
8
8
clickhouse:*:*:*:clickhouse:P4ssw0rd
9
+ couchbase:*:*:*:Administrator:P4ssw0rd
9
10
godror:*:*:*:system:P4ssw0rd
10
11
ignite:*:*:*:ignite:ignite
11
12
mymysql:*:*:*:root:P4ssw0rd
Original file line number Diff line number Diff line change 4
4
package couchbase
5
5
6
6
import (
7
+ "context"
8
+ "strconv"
7
9
"strings"
8
10
9
11
_ "github.com/couchbase/go_n1ql" // DRIVER: n1ql
@@ -13,6 +15,27 @@ import (
13
15
func init () {
14
16
drivers .Register ("n1ql" , drivers.Driver {
15
17
AllowMultilineComments : true ,
18
+ Version : func (ctx context.Context , db drivers.DB ) (string , error ) {
19
+ ver := "<unknown>"
20
+ /*
21
+ var buf []byte
22
+ if err := db.QueryRowContext(ctx, `SELECT ds_version() AS version`).Scan(&buf); err == nil {
23
+ var m map[string]string
24
+ if err := json.Unmarshal(buf, &m); err == nil {
25
+ if s, ok := m["version"]; ok {
26
+ ver = s
27
+ }
28
+ }
29
+ }
30
+ */
31
+ var v string
32
+ if err := db .QueryRowContext (ctx , `SELECT RAW ds_version()` ).Scan (& v ); err == nil {
33
+ if s , err := strconv .Unquote (v ); err == nil {
34
+ ver = s
35
+ }
36
+ }
37
+ return "Couchbase " + ver , nil
38
+ },
16
39
Err : func (err error ) (string , string ) {
17
40
return "" , strings .TrimPrefix (err .Error (), "N1QL: " )
18
41
},
Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ require (
55
55
github.com/trinodb/trino-go-client v0.313.0
56
56
github.com/uber/athenadriver v1.1.15
57
57
github.com/vertica/vertica-sql-go v1.3.3
58
- github.com/xo/dburl v0.21.1
58
+ github.com/xo/dburl v0.22.0
59
59
github.com/xo/tblfmt v0.12.0
60
60
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e
61
61
github.com/ydb-platform/ydb-go-sdk/v3 v3.57.4
Original file line number Diff line number Diff line change @@ -1005,8 +1005,8 @@ github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17
1005
1005
github.com/xeipuuv/gojsonschema v1.2.0 /go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y =
1006
1006
github.com/xhit/go-str2duration/v2 v2.1.0 h1:lxklc02Drh6ynqX+DdPyp5pCKLUQpRT8bp8Ydu2Bstc =
1007
1007
github.com/xhit/go-str2duration/v2 v2.1.0 /go.mod h1:ohY8p+0f07DiV6Em5LKB0s2YpLtXVyJfNt1+BlmyAsU =
1008
- github.com/xo/dburl v0.21.1 h1:n5mfH1fh51RQbvuaKKykGslodt8pZqyZJMNohVo2zK0 =
1009
- github.com/xo/dburl v0.21.1 /go.mod h1:B7/G9FGungw6ighV8xJNwWYQPMfn3gsi2sn5SE8Bzco =
1008
+ github.com/xo/dburl v0.22.0 h1:sO5WLm2ywMzyiLxEcLBlw5AyKvdR5hirq9U7s3fCoeM =
1009
+ github.com/xo/dburl v0.22.0 /go.mod h1:B7/G9FGungw6ighV8xJNwWYQPMfn3gsi2sn5SE8Bzco =
1010
1010
github.com/xo/tblfmt v0.0.0-20190609041254-28c54ec42ce8 /go.mod h1:3U5kKQdIhwACye7ml3acccHmjGExY9WmUGU7rnDWgv0 =
1011
1011
github.com/xo/tblfmt v0.12.0 h1:3nQGkyGiqzy+H9bcERrqmiK2pSpQKkjn/f5D8oeXSqI =
1012
1012
github.com/xo/tblfmt v0.12.0 /go.mod h1:AKivZTttxEXXrztqGl0dGVh4hsEOSGIfSZNbRhnKZuo =
You can’t perform that action at this time.
0 commit comments