Skip to content

Commit

Permalink
Update xsql QueryFirst()
Browse files Browse the repository at this point in the history
  • Loading branch information
onanying committed Jun 7, 2024
1 parent 7589410 commit 0a25d6d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/xsql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,18 @@ bar := rows[0].Get("bar").Time() // time.Time
val := rows[0].Get("bar").Value() // interface{}
```

```go
row, err := DB.QueryFirst("SELECT * FROM xsql WHERE id = ?", 1)
if err != nil {
log.Fatal(err)
}

id := row.Get("id").Int()
foo := row.Get("foo").String()
bar := row.Get("bar").Time() // time.Time
val := row.Get("bar").Value() // interface{}
```

### Mapping

Of course, you can also map usage like `gorm`, `xorm`.
Expand Down

0 comments on commit 0a25d6d

Please sign in to comment.