-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdriver.go
92 lines (86 loc) · 4.19 KB
/
driver.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package january
import (
"database/sql"
_ "github.com/jackc/pgconn"
_ "github.com/jackc/pgx/v4"
_ "github.com/jackc/pgx/v4/stdlib"
)
func (j *January) OpenDBConnection(dbType, dsn string) (*sql.DB, error) {
if dbType == "postgres" || dbType == "postgresql" {
dbType = "pgx" // driver
}
db, err := sql.Open(dbType, dsn)
if err != nil {
return nil, err
}
err = db.Ping()
if err != nil {
return nil, err
}
return db, nil
}
// dbType =
// Golang drivers: https://go.dev/wiki/SQLDrivers
//Amazon AWS Athena: https://github.com/uber/athenadriver
//AWS Athena: https://github.com/segmentio/go-athena
//AWS DynamoDB: https://github.com/btnguyen2k/godynamo
//Apache Avatica/Phoenix: https://github.com/apache/calcite-avatica-go
//Apache H2: https://github.com/jmrobles/h2go
//Apache Hive: https://github.com/sql-machine-learning/gohive
//Apache Ignite/GridGain: https://github.com/amsokol/ignite-go-client
//Apache Impala: https://github.com/bippio/go-impala
//Azure Cosmos DB: https://github.com/btnguyen2k/gocosmos
//ClickHouse (uses HTTP API): https://github.com/mailru/go-clickhouse
//ClickHouse (uses native TCP interface): https://github.com/ClickHouse/clickhouse-go
//CockroachDB: Use any PostgreSQL driver
//Couchbase N1QL: https://github.com/couchbase/go_n1ql
//DB2 LUW (uses cgo): https://github.com/asifjalil/cli
//DB2 LUW and DB2/Z with DB2-Connect: https://bitbucket.org/phiggins/db2cli (Last updated 2015-08)
//DB2 LUW, z/OS, iSeries and Informix: https://github.com/ibmdb/go_ibm_db
//Databricks: https://github.com/databricks/databricks-sql-go
//DuckDB: https://github.com/marcboeker/go-duckdb
//Exasol: (pure Go): https://github.com/exasol/exasol-driver-go
//Firebird SQL: https://github.com/nakagami/firebirdsql
//Genji (pure go): https://github.com/genjidb/genji
//Google Cloud BigQuery: https://github.com/solcates/go-sql-bigquery
//Google Cloud Spanner: https://github.com/googleapis/go-sql-spanner
//Google Cloud Spanner: https://github.com/rakyll/go-sql-driver-spanner
//MS ADODB: https://github.com/mattn/go-adodb
//MS SQL Server (pure go): https://github.com/microsoft/go-mssqldb
//MS SQL Server (uses cgo): https://github.com/minus5/gofreetds
//MaxCompute: https://github.com/sql-machine-learning/gomaxcompute
//MySQL: https://github.com/go-sql-driver/mysql/ [*]
//MySQL: https://github.com/siddontang/go-mysql/ [**] (also handles replication)
//MySQL: https://github.com/ziutek/mymysql [*]
//ODBC: https://bitbucket.org/miquella/mgodbc (Last updated 2016-02)
//ODBC: https://github.com/alexbrainman/odbc
//Oracle (pure go): https://github.com/sijms/go-ora
//Oracle (uses cgo): https://github.com/godror/godror
//Oracle (uses cgo): https://github.com/mattn/go-oci8
//Oracle (uses cgo): https://gopkg.in/rana/ora.v4
//Postgres (pure Go): https://github.com/jackc/pgx [*]
//Postgres (pure Go): https://github.com/lib/pq [*]
//Postgres (uses cgo): https://github.com/jbarham/gopgsqldriver
//Presto: https://github.com/prestodb/presto-go-client
//QL: https://pkg.go.dev/modernc.org/ql
//SAP ASE (pure go): https://github.com/SAP/go-ase
//SAP ASE (uses cgo): https://github.com/SAP/cgo-ase
//SAP HANA (pure go): https://github.com/SAP/go-hdb
//SAP HANA (uses cgo): https://help.sap.com/viewer/0eec0d68141541d1b07893a39944924e/2.0.03/en-US/0ffbe86c9d9f44338441829c6bee15e6.html
//SQL over REST: https://github.com/adaptant-labs/go-sql-rest-driver
//SQLite (uses cgo): https://github.com/gwenn/gosqlite - Supports SQLite dynamic data typing
//SQLite (uses cgo): https://github.com/mattn/go-sqlite3 [*]
//SQLite (uses cgo): https://github.com/mxk/go-sqlite
//SQLite: (pure go): https://modernc.org/sqlite
//SQLite: (pure go): https://github.com/ncruces/go-sqlite3
//SQLite: (uses cgo): https://github.com/rsc/sqlite
//SingleStore: Use any MySQL driver
//Snowflake (pure Go): https://github.com/snowflakedb/gosnowflake
//Sybase ASE (pure go): https://github.com/thda/tds
//Sybase SQL Anywhere: https://github.com/a-palchikov/sqlago
//TiDB: Use any MySQL driver
//Trino: https://github.com/trinodb/trino-go-client
//Vertica: https://github.com/vertica/vertica-sql-go
//Vitess: https://pkg.go.dev/vitess.io/vitess/go/vt/vitessdriver
//YDB (pure go): https://github.com/ydb-platform/ydb-go-sdk
//YQL (Yahoo! Query Language): https://github.com/mattn/go-yql