From 4e9b0a273bbc202b2083993254722f4e96838453 Mon Sep 17 00:00:00 2001 From: qqxhb <30866940+qqxhb@users.noreply.github.com> Date: Mon, 28 Aug 2023 16:14:44 +0800 Subject: [PATCH] Update query.md --- pages/gen/query.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 +```