Skip to content

Commit

Permalink
Update query.md
Browse files Browse the repository at this point in the history
  • Loading branch information
qqxhb authored Aug 28, 2023
1 parent a931c98 commit 4e9b0a2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pages/gen/query.md
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ Get first matched record or create a new one with given conditions (only works w
```go

// Found user with `name` = `gen`
result := u.WithContext(ctx).Where(u.Name.Eq(jinzhu)).FirstOrCreate(&user)
result := u.WithContext(ctx).Where(u.Name.Eq(jinzhu)).FirstOrCreate()
// user -> User{ID: 111, Name: "gen", "Age": 18}
// result.RowsAffected // => 0
```
Expand Down Expand Up @@ -602,4 +602,4 @@ u.WithContext(ctx).Where(field.Attrs(&User{Name: "gen"}).Select(u.Name,u.Age)).F

u.WithContext(ctx).Where(field.Attrs(&User{Name: "gen"}).Select(u.Age)).Find()
// SELECT * FROM users WHERE age = 0;
```
```

0 comments on commit 4e9b0a2

Please sign in to comment.