mirror of https://github.com/aldy505/bob.git
docs: tabs to space
This commit is contained in:
parent
80893d1fdf
commit
75547d606a
18
README.md
18
README.md
|
@ -25,18 +25,18 @@ func main() {
|
||||||
|
|
||||||
// Check if a table is exists
|
// Check if a table is exists
|
||||||
sql, args, err = bob.HasTable("users").PlaceholderFormat(bob.Dollar).ToSQL()
|
sql, args, err = bob.HasTable("users").PlaceholderFormat(bob.Dollar).ToSQL()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
var hasTableUsers bool
|
var hasTableUsers bool
|
||||||
err = db.QueryRow(context.Background(), sql, args...).Scan(&hasTableUsers)
|
err = db.QueryRow(context.Background(), sql, args...).Scan(&hasTableUsers)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err.Error() == "no rows in result set" {
|
if err.Error() == "no rows in result set" {
|
||||||
hasTableUsers = false
|
hasTableUsers = false
|
||||||
} else {
|
} else {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !hasTableUsers {
|
if !hasTableUsers {
|
||||||
|
@ -57,9 +57,9 @@ func main() {
|
||||||
splitQuery := strings.Split(sql, ";")
|
splitQuery := strings.Split(sql, ";")
|
||||||
for i := range splitQuery {
|
for i := range splitQuery {
|
||||||
_, err = db.Query(context.Background(), splitQuery[i])
|
_, err = db.Query(context.Background(), splitQuery[i])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue