An open API service indexing awesome lists of open source software.

https://github.com/jimsmart/drivercaps

drivercaps is a Go package to analyse and report database/sql drivers' column type metadata capabilities.
https://github.com/jimsmart/drivercaps

feature-tests go sql-driver

Last synced: 9 months ago
JSON representation

drivercaps is a Go package to analyse and report database/sql drivers' column type metadata capabilities.

Awesome Lists containing this project

README

          

# drivercaps

[![BSD3](https://img.shields.io/badge/license-BSD3-blue.svg?style=flat)](LICENSE.md)

drivercaps is a [Go](https://golang.org) package to analyse and report database/sql drivers' column metadata capabilities.

TODO more docs

## Why?

Different database drivers have varying levels of support for [sql.ColumnType](https://golang.org/pkg/database/sql/#ColumnType), this project shines some light on the subject.

## What?

Currently supporting the following database engines:

- Microsoft SQL Server
- MySQL
- Oracle
- Postgres
- SQLite

## Driver sql.ColumnType Capability Reports

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](https://github.com/jimsmart/drivercaps/tree/master/mssql/denisenkom) | Yes | Yes | Yes | Yes | Yes | Typed
github.com/minus5/gofreetds | MS SQL Server | [View](https://github.com/jimsmart/drivercaps/tree/master/mssql/minus5) | Yes | No | No | No | No | Default [1]
github.com/go-sql-driver/mysql | MySQL | [View](https://github.com/jimsmart/drivercaps/tree/master/mysql/gosqldriver) | Yes | Yes | Yes | Mostly [2] | No | Typed
github.com/ziutek/mymysql | MySQL | [View](https://github.com/jimsmart/drivercaps/tree/master/mysql/ziutek) | Yes | No | No | No | No | Default [1]
github.com/go-goracle/goracle | Oracle | [View](https://github.com/jimsmart/drivercaps/tree/master/oracle/goracle) | Yes | Yes | Yes | Mostly [3] | Yes | Typed
github.com/mattn/go-oci8 | Oracle | [View](https://github.com/jimsmart/drivercaps/tree/master/oracle/mattn) | Yes | Invalid [4] | No | No | Yes | Invalid [5]
github.com/rana/ora | Oracle | [View](https://github.com/jimsmart/drivercaps/tree/master/oracle/rana) | Yes | Yes | Invalid [6] | Kinda [7] | Yes | Typed [8]
github.com/jackc/pgx | Postgres | [View](https://github.com/jimsmart/drivercaps/tree/master/postgres/jackc) | Yes | Yes | No | Kinda [9] | Yes | Typed
github.com/jbarham/gopgsqldriver | Postgres | [View](https://github.com/jimsmart/drivercaps/tree/master/postgres/jbarham) | Yes | No | No | No | No | Default [1]
github.com/lib/pq | Postgres | [View](https://github.com/jimsmart/drivercaps/tree/master/postgres/lib) | Yes | Yes | No | Kinda [9] | Yes | Typed
github.com/gwenn/gosqlite | SQLite | [View](https://github.com/jimsmart/drivercaps/tree/master/sqlite/gwenn) | Yes | Yes [10] | No | No | No | Invalid [11]
github.com/mattn/go-sqlite3 | SQLite | [View](https://github.com/jimsmart/drivercaps/tree/master/sqlite/mattn) | Yes | Yes [10] | Invalid [6] | No | No | Invalid [11]
github.com/mxk/go-sqlite | SQLite | [View](https://github.com/jimsmart/drivercaps/tree/master/sqlite/mxk) | 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

## Installation

To install and produce your own reports locally:

```bash
$ go get github.com/jimsmart/drivercaps
```

## Usage

Change directory to the drivercaps root folder and execute:

```bash
$ go test -test.v ./...
```

## Output

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.

## License

Package drivercaps is copyright 2018 by Jim Smart and released under the [BSD 3-Clause License](LICENSE.md)