Skip to content

Commit

Permalink
Fix lint in example of httpPlusDb
Browse files Browse the repository at this point in the history
  • Loading branch information
RonFed committed Jul 28, 2023
1 parent 15c04be commit 68a2f02
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions examples/httpPlusdb/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@
package main

import (
"database/sql"
"fmt"
"net/http"
"database/sql"

_ "github.com/mattn/go-sqlite3"
"go.uber.org/zap"
)

const sql_query = "SELECT * FROM contacts"
const sqlQuery = "SELECT * FROM contacts"

// Server is Http server that exposes multiple endpoints.
type Server struct {
Expand Down Expand Up @@ -50,23 +51,23 @@ func (s *Server) queryDb(w http.ResponseWriter, req *http.Request) {
panic(err)
}

rows, err := conn.QueryContext(req.Context(), sql_query)
rows, err := conn.QueryContext(req.Context(), sqlQuery)
if err != nil {
panic(err)
}

logger.Info("queryDb called")
for rows.Next() {
var id int
var first_name string
var last_name string
var firstName string
var lastName string
var email string
var phone string
err := rows.Scan(&id, &first_name, &last_name, &email, &phone)
err := rows.Scan(&id, &firstName, &lastName, &email, &phone)
if err != nil {
panic(err)
}
fmt.Fprintf(w, "ID: %d, first_name: %s, last_name: %s, email: %s, phone: %s\n", id, first_name, last_name, email, phone)
fmt.Fprintf(w, "ID: %d, firstName: %s, lastName: %s, email: %s, phone: %s\n", id, firstName, lastName, email, phone)
}
}

Expand Down

0 comments on commit 68a2f02

Please sign in to comment.