Files
howmuch/internal/howmuch/adapter/repo/sqlc/user.sql.go
Muyao CHEN 0da8b29507
All checks were successful
Build and test / Build (push) Successful in 2m27s
test: try to test user repo and event repo
2024-10-23 09:54:00 +02:00

92 lines
1.8 KiB
Go

// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.27.0
// source: user.sql
package sqlc
import (
"context"
"time"
)
const getUserByEmail = `-- name: GetUserByEmail :one
SELECT id, email, first_name, last_name, password, created_at, updated_at
FROM "user"
WHERE email = $1
`
func (q *Queries) GetUserByEmail(ctx context.Context, email string) (User, error) {
row := q.db.QueryRowContext(ctx, getUserByEmail, email)
var i User
err := row.Scan(
&i.ID,
&i.Email,
&i.FirstName,
&i.LastName,
&i.Password,
&i.CreatedAt,
&i.UpdatedAt,
)
return i, err
}
const getUserByID = `-- name: GetUserByID :one
SELECT id, email, first_name, last_name, password, created_at, updated_at
FROM "user"
WHERE id = $1
`
func (q *Queries) GetUserByID(ctx context.Context, id int32) (User, error) {
row := q.db.QueryRowContext(ctx, getUserByID, id)
var i User
err := row.Scan(
&i.ID,
&i.Email,
&i.FirstName,
&i.LastName,
&i.Password,
&i.CreatedAt,
&i.UpdatedAt,
)
return i, err
}
const insertUser = `-- name: InsertUser :one
INSERT INTO "user" (
email, first_name, last_name, password, created_at, updated_at
) VALUES ( $1, $2, $3, $4, $5, $6 )
RETURNING id, email, first_name, last_name, password, created_at, updated_at
`
type InsertUserParams struct {
Email string
FirstName string
LastName string
Password string
CreatedAt time.Time
UpdatedAt time.Time
}
func (q *Queries) InsertUser(ctx context.Context, arg InsertUserParams) (User, error) {
row := q.db.QueryRowContext(ctx, insertUser,
arg.Email,
arg.FirstName,
arg.LastName,
arg.Password,
arg.CreatedAt,
arg.UpdatedAt,
)
var i User
err := row.Scan(
&i.ID,
&i.Email,
&i.FirstName,
&i.LastName,
&i.Password,
&i.CreatedAt,
&i.UpdatedAt,
)
return i, err
}