smallnest/gen

Postgres and SQLite driver support for sql.ColumnType.Nullable()

jimsmart opened this issue · 2 comments

Hi,

I see you are using my 'schema' package! This is just a quick note to inform you of its limitations...

It works very well with some drivers, and not so well with others: sadly, not all drivers provide full support for methods on sql.ColumnType

Drivers with good/working .Nullable() support:

  • MS SQL - github.com/denisenkom/go-mssqldb
  • MySQL - github.com/go-sql-driver/mysql
  • Oracle - github.com/go-goracle/goracle

But I have not yet found a driver with support for .Nullable() on Postgres nor SQLite.

For further details see the report(s) at https://github.com/jimsmart/drivercaps — it's quite a can of worms.

I think the best solution is for the upstream drivers to add this missing support? But I have not yet filed any issues upstream, nor had time to look at any of the drivers' code.

HTH

thank you for pointing this case and I will add this into readme. It is very important and hope all drivers add this feature. @jimsmart

The code has been refactored to use the 'schema' package, but it will also fetch using sql varios meta data for mysql, ms sql, postgres and sqlite. This helps fill in nullable column info, size, primary key meta data.

If it is an unknown db, it will rely solely on schema package