drivercaps

package module
v0.0.0-...-aa8e1bb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 1, 2018 License: BSD-3-Clause Imports: 15 Imported by: 0

README

drivercaps

BSD3

drivercaps is a Go 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, 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 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

Installation

To install and produce your own reports locally:

$ go get github.com/jimsmart/drivercaps

Usage

Change directory to the drivercaps root folder and execute:

$ 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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReportForDriver

func ReportForDriver(test *DriverTest) error

Types

type ColumnDefn

type ColumnDefn struct {
	DDL string // e.g. VARCHAR(255)

}

type DriverTest

type DriverTest struct {
	Database  string
	PkgURL    string
	PkgName   string
	DrvName   string
	ConnStr   string
	Columns   []*ColumnDefn
	CreateOpt string
	PKType    string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL