This commit is contained in:
Yasuhiro Matsumoto 2022-05-28 23:24:03 +09:00
parent 5131ffb8eb
commit 2cd93c9677
No known key found for this signature in database
GPG Key ID: 622DE34DC490584B
1 changed files with 12 additions and 13 deletions

View File

@ -42,10 +42,10 @@ func main() {
log.Fatal(err) log.Fatal(err)
} }
stmt, err := tx.Prepare(` stmt, err := tx.Prepare(`
insert into iris( insert into iris(
sepal_length, sepal_width, petal_length, petal_width, class) sepal_length, sepal_width, petal_length, petal_width, class)
values(?, ?, ?, ?, ?) values(?, ?, ?, ?, ?)
`) `)
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }
@ -82,15 +82,14 @@ func main() {
tx.Commit() tx.Commit()
rows, err := db.Query(`select rows, err := db.Query(`select
json_object( json_object(
'sepal_length', sepal_length, 'sepal_length', sepal_length,
'sepal_width', sepal_width, 'sepal_width', sepal_width,
'petal_length', petal_length, 'petal_length', petal_length,
'petal_width', petal_width, 'petal_width', petal_width,
'class', class 'class', class
) ) from iris
from iris `)
`)
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }