Begun implementing all tests

* Added randomizeStruct
* Added under development warning to readme
* Restructured the reflection stuff a bit
* Added a testmangle.go file for template test functions
This commit is contained in:
Patrick O'brien 2016-05-17 20:00:56 +10:00
parent 019ab3b502
commit c2541ea56e
12 changed files with 492 additions and 12 deletions

View file

@ -91,9 +91,17 @@ func (p *PostgresDriver) Columns(tableName string) ([]Column, error) {
defer rows.Close()
for rows.Next() {
var colName, colType, colDefault, isNullable string
if err := rows.Scan(&colName, &colType, &colDefault, &isNullable); err != nil {
return nil, err
var defaultPtr *string
if err := rows.Scan(&colName, &colType, &defaultPtr, &isNullable); err != nil {
return nil, fmt.Errorf("Unable to scan for table %s: %s", tableName, err)
}
if defaultPtr == nil {
colDefault = ""
} else {
colDefault = *defaultPtr
}
column := Column{
Name: colName,
Type: colType,