drivercaps is a Go package to analyse and report database/sql drivers' column metadata capabilities.
TODO more docs
Different database drivers have varying levels of support for sql.ColumnType, this project shines some light on the subject.
Currently supporting the following database engines:
- Microsoft SQL Server
- MySQL
- Oracle
- Postgres
- SQLite
TODO generate report table (vs manual maintenance)
Driver | Database | Report | .Name Support |
.DBTypeName Support |
.Nullable Support |
.DecimalSize Support |
.Length Support |
.ScanType Support |
---|---|---|---|---|---|---|---|---|
github.com/denisenkom/go-mssqldb | MS SQL Server | View | Yes | Yes | Yes | Yes | Yes | Typed |
github.com/minus5/gofreetds | MS SQL Server | View | Yes | No | No | No | No | Default [1] |
github.com/go-sql-driver/mysql | MySQL | View | Yes | Yes | Yes | Mostly [2] | No | Typed |
github.com/ziutek/mymysql | MySQL | View | Yes | No | No | No | No | Default [1] |
github.com/go-goracle/goracle | Oracle | View | Yes | Yes | Yes | Mostly [3] | Yes | Typed |
github.com/mattn/go-oci8 | Oracle | View | Yes | Invalid [4] | No | No | Yes | Invalid [5] |
github.com/rana/ora | Oracle | View | Yes | Yes | Invalid [6] | Kinda [7] | Yes | Typed [8] |
github.com/jackc/pgx | Postgres | View | Yes | Yes | No | Kinda [9] | Yes | Typed |
github.com/jbarham/gopgsqldriver | Postgres | View | Yes | No | No | No | No | Default [1] |
github.com/lib/pq | Postgres | View | Yes | Yes | No | Kinda [9] | Yes | Typed |
github.com/gwenn/gosqlite | SQLite | View | Yes | Yes [10] | No | No | No | Invalid [11] |
github.com/mattn/go-sqlite3 | SQLite | View | Yes | Yes [10] | Invalid [6] | No | No | Invalid [11] |
github.com/mxk/go-sqlite | SQLite | View | Yes | No | No | No | No | Default [1] |
[1] interface{} only
[2] float and double types have invalid precision and scale value MaxInt64
[3] number and float have invalid default scale value -127, float type has invalid? default precision value 126
[4] exposes only internal type codenames
[5] invalid scan type []string
[6] reports everything as nullable
[7] number and float types have invalid scale value -127
[8] binary_float and binary_double have invalid scan type nil
[9] numeric and decimal types have invalid default precision and scale values 65535, 65531
[10] type name includes length and precision values
[11] invalid scan type nil
To install and produce your own reports locally:
$ go get github.com/jimsmart/drivercaps
Change directory to the drivercaps root folder and execute:
$ go test -test.v ./...
After execution, capability reports for each driver can be found in the leaf folders of the package, e.g.
- drivercaps/oracle/goracle/report.csv
- drivercaps/oracle/goracle/report.txt
- drivercaps/oracle/goracle/README.md
- drivercaps/postgres/jackc/report.csv
- etc.
Package drivercaps is copyright 2018 by Jim Smart and released under the BSD 3-Clause License