Skip to content

Commit

Permalink
Adding bad driver tag, moving impala driver to bad group
Browse files Browse the repository at this point in the history
Adds a 'bad' build tag, and moves impala to bad group.
  • Loading branch information
kenshaw committed Aug 25, 2022
1 parent 640be50 commit 44576a8
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ associated database, scheme / build tag, and scheme aliases:
| Vertica | `vertica` | `ve` | [github.com/vertica/vertica-sql-go][d-vertica] |
| VoltDB | `voltdb` | `vo`, `vdb`, `volt` | [github.com/VoltDB/voltdb-client-go/voltdbclient][d-voltdb] |
| | | | |
| Apache Impala | `impala` | `im` | [github.com/bippio/go-impala][d-impala] |
| GO DRiver for ORacle | `godror` | `gr` | [github.com/godror/godror][d-godror] <sup>[][f-cgo]</sup> |
| ODBC | `odbc` | `od` | [github.com/alexbrainman/odbc][d-odbc] <sup>[][f-cgo]</sup> |
| | | | |
Expand All @@ -239,9 +238,12 @@ associated database, scheme / build tag, and scheme aliases:
| TiDB | `mysql` | `ti`, `tidb` | [github.com/go-sql-driver/mysql][d-mysql] <sup>[][f-wire]</sup> |
| Vitess Database | `mysql` | `vt`, `vitess` | [github.com/go-sql-driver/mysql][d-mysql] <sup>[][f-wire]</sup> |
| | | | |
| Apache Impala | `impala` | `im` | [github.com/bippio/go-impala][d-impala] |
| | | | |
| **NO DRIVERS** | `no_base` | | _no base drivers (useful for development)_ |
| **MOST DRIVERS** | `most` | | _all stable drivers_ |
| **ALL DRIVERS** | `all` | | _all drivers_ |
| **ALL DRIVERS** | `all` | | _all drivers, excluding bad drivers_ |
| **BAD DRIVERS** | `bad` | | _bad drivers (broken/non-working drivers)_ |
| **NO &lt;TAG&gt;** | `no_<tag>` | | _exclude driver with `<tag>`_ |

[d-adodb]: https://github.com/mattn/go-adodb
Expand Down
2 changes: 1 addition & 1 deletion drivers/impala/impala.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Package impala defines and registers usql's Apache Impala driver.
//
// See: https://github.com/bippio/go-impala
// Group: all
// Group: bad
package impala

import (
Expand Down
17 changes: 14 additions & 3 deletions gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ var mostDrivers = map[string]DriverInfo{}
// allDrivers are drivers forced to 'all' build tag.
var allDrivers = map[string]DriverInfo{}

// badDrivers are drivers forced to 'bad' build tag.
var badDrivers = map[string]DriverInfo{}

// wireDrivers are the wire compatible drivers.
var wireDrivers = map[string]DriverInfo{}

Expand All @@ -78,7 +81,7 @@ func run(licenseStart int, licenseAuthor string) error {
if err := loadDrivers(filepath.Join(wd, "drivers")); err != nil {
return err
}
if err := writeInternal(filepath.Join(wd, "internal"), baseDrivers, mostDrivers, allDrivers); err != nil {
if err := writeInternal(filepath.Join(wd, "internal"), baseDrivers, mostDrivers, allDrivers, badDrivers); err != nil {
return err
}
if err := writeReadme(wd); err != nil {
Expand Down Expand Up @@ -116,6 +119,8 @@ func loadDrivers(wd string) error {
case driver.Group == "most":
case driver.Group == "all":
dest = allDrivers
case driver.Group == "bad":
dest = badDrivers
default:
return fmt.Errorf("driver %s has invalid group %q", tag, driver.Group)
}
Expand Down Expand Up @@ -243,6 +248,8 @@ func writeInternal(wd string, drivers ...map[string]DriverInfo) error {
tags = "(all || most || " + v.Tag + ")"
case "all":
tags = "(all || " + v.Tag + ")"
case "bad":
tags = "(bad || " + v.Tag + ")"
default:
panic(v.Tag)
}
Expand Down Expand Up @@ -315,6 +322,7 @@ func buildDriverTable() string {
baseRows, widths := buildRows(baseDrivers, widths)
mostRows, widths := buildRows(mostDrivers, widths)
allRows, widths := buildRows(allDrivers, widths)
badRows, widths := buildRows(badDrivers, widths)
wireRows, widths := buildRows(wireDrivers, widths)
s := tableRows(widths, ' ', hdr)
s += tableRows(widths, '-')
Expand All @@ -326,13 +334,16 @@ func buildDriverTable() string {
s += tableRows(widths, ' ')
s += tableRows(widths, ' ', wireRows...)
s += tableRows(widths, ' ')
s += tableRows(widths, ' ', badRows...)
s += tableRows(widths, ' ')
s += tableRows(widths, ' ',
[]string{"**NO DRIVERS**", "`no_base`", "", "_no base drivers (useful for development)_"},
[]string{"**MOST DRIVERS**", "`most`", "", "_all stable drivers_"},
[]string{"**ALL DRIVERS**", "`all`", "", "_all drivers_"},
[]string{"**ALL DRIVERS**", "`all`", "", "_all drivers, excluding bad drivers_"},
[]string{"**BAD DRIVERS**", "`bad`", "", "_bad drivers (broken/non-working drivers)_"},
[]string{"**NO &lt;TAG&gt;**", "`no_<tag>`", "", "_exclude driver with `<tag>`_"},
)
return s + "\n" + buildTableLinks(baseDrivers, mostDrivers, allDrivers)
return s + "\n" + buildTableLinks(baseDrivers, mostDrivers, allDrivers, badDrivers)
}

var baseOrder = map[string]int{
Expand Down
2 changes: 1 addition & 1 deletion internal/impala.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 44576a8

Please sign in to comment.