Skip to content

Commit ec7870b

Browse files
committed
Run the code through gofmt
1 parent 443e6cd commit ec7870b

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

connection.go

+4-5
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ package restsql
1616

1717
import (
1818
"database/sql/driver"
19-
"net/http"
2019
"encoding/json"
2120
"io"
2221
"log"
22+
"net/http"
2323
)
2424

2525
type restsqlConn struct {
26-
url string
26+
url string
2727
}
2828

2929
// Begin is stubbed out, but is necessary to satisfy the interface requirements
@@ -40,7 +40,7 @@ func (rc *restsqlConn) Prepare(query string) (driver.Stmt, error) {
4040
// Query carries out a basic SQL query on a REST API endpoint. This presently
4141
// takes the form of the raw query being appended to the base path.
4242
func (rc *restsqlConn) Query(query string, args []driver.Value) (driver.Rows, error) {
43-
res, err := http.Get(rc.url+query)
43+
res, err := http.Get(rc.url + query)
4444
if err != nil {
4545
return nil, driver.ErrBadConn
4646
}
@@ -49,13 +49,12 @@ func (rc *restsqlConn) Query(query string, args []driver.Value) (driver.Rows, er
4949

5050
rows := new(jsonRows)
5151
rows.rc = rc
52-
5352

5453
dec := json.NewDecoder(res.Body)
5554
for {
5655
var data interface{}
5756

58-
err = dec.Decode(&data);
57+
err = dec.Decode(&data)
5958
if err == io.EOF {
6059
return rows, nil
6160
} else if err != nil {

driver.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ import (
2424
// RESTSQLDriver is exported to make the driver directly accessible where
2525
// needed. General usage is expected to be constrained to the database/sql
2626
// APIs.
27-
type RESTSQLDriver struct{
27+
type RESTSQLDriver struct {
2828
}
2929

3030
// Open prepares a destination URL endpoint that raw queries are appended to.
3131
// The actual establishment of the connection is deferred until Query time.
32-
func (d RESTSQLDriver) Open(url string)(driver.Conn, error) {
32+
func (d RESTSQLDriver) Open(url string) (driver.Conn, error) {
3333
var err error
3434

35-
rc := &restsqlConn{url: url};
35+
rc := &restsqlConn{url: url}
3636

3737
return rc, err
3838
}

rows.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ import (
2222
type resultSet struct {
2323
// As we deal with dynamic JSON responses, leave this as an interface
2424
// type for client-side unmarshalling and struct mapping.
25-
data []interface{}
26-
num int
25+
data []interface{}
26+
num int
2727
}
2828

2929
type jsonRows struct {
30-
rc *restsqlConn
31-
rs resultSet
30+
rc *restsqlConn
31+
rs resultSet
3232
}
3333

3434
// By default we return a single column, which embodies the entire row response from the query.
@@ -37,7 +37,7 @@ func (rows *jsonRows) Columns() []string {
3737
}
3838

3939
func (rows *jsonRows) Next(dest []driver.Value) error {
40-
if (rows.rs.num == len(rows.rs.data)) {
40+
if rows.rs.num == len(rows.rs.data) {
4141
return io.EOF
4242
}
4343

0 commit comments

Comments
 (0)