code example correction
This commit is contained in:
@@ -48,7 +48,10 @@ once you have the schama files created you can use `pgm` as
|
||||
```go
|
||||
package main
|
||||
|
||||
import "code.partial.tech/go/pgm"
|
||||
import (
|
||||
"code.partial.tech/go/pgm"
|
||||
"myapp/db/user" // scham create by pgm/cmd
|
||||
)
|
||||
|
||||
type MyModel struct {
|
||||
ID string
|
||||
@@ -64,8 +67,8 @@ func main() {
|
||||
// Select query to fetch the first record
|
||||
// Assumes the schema is defined in the "db" package with a User table
|
||||
var v MyModel
|
||||
err := db.User.Select(db.User.ID, db.User.Email).
|
||||
Where(db.User.Email.Like("anki%")).
|
||||
err := db.User.Select(user.ID, user.Email).
|
||||
Where(user.Email.Like("anki%")).
|
||||
First(context.TODO(), &v.ID, &v.Email)
|
||||
if err != nil {
|
||||
println("Error:", err.Error())
|
||||
|
Reference in New Issue
Block a user