Simplify repo example

new-query-chunks-api
Vinícius Garcia 2022-05-07 22:30:30 -03:00
parent 527c79ad1c
commit 3701f0f325
1 changed files with 2 additions and 2 deletions

View File

@ -13,14 +13,14 @@ var usersTable = ksql.NewTable("users", "id")
// This function doesn't care if db is a transaction or not:
func GetUser(ctx context.Context, db ksql.Provider, userId int) (User, error) {
var user User
err := db.QueryOne(ctx, &user, "FROM users WHERE id = ?", userId)
err := db.QueryOne(ctx, &user, "SELECT * FROM users WHERE id = ?", userId)
return user, err
}
// This function doesn't care if db is a transaction or not:
func GetUserByEmail(ctx context.Context, db ksql.Provider, email string) (User, error) {
var user User
err := db.QueryOne(ctx, &user, "FROM users WHERE email = ?", email)
err := db.QueryOne(ctx, &user, "SELECT * FROM users WHERE email = ?", email)
return user, err
}