diff --git a/pages/gen/query.md b/pages/gen/query.md index 8c055c7ec88..91535b5a768 100644 --- a/pages/gen/query.md +++ b/pages/gen/query.md @@ -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 ``` @@ -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; -``` \ No newline at end of file +```