// Code generated by sqlc. DO NOT EDIT. // source: email.sql package database import ( "context" "time" ) const createEmail = `-- name: CreateEmail :one INSERT INTO "email" ( "address", "user_id", "created_at" ) VALUES ( $1, $2, $3 ) RETURNING address, user_id, created_at ` type CreateEmailParams struct { Address string `json:"address"` UserID int64 `json:"user_id"` CreatedAt time.Time `json:"created_at"` } func (q *Queries) CreateEmail(ctx context.Context, arg CreateEmailParams) (Email, error) { row := q.db.QueryRowContext(ctx, createEmail, arg.Address, arg.UserID, arg.CreatedAt) var i Email err := row.Scan(&i.Address, &i.UserID, &i.CreatedAt) return i, err } const destroyEmail = `-- name: DestroyEmail :exec DELETE FROM "email" WHERE "address" = $1 ` func (q *Queries) DestroyEmail(ctx context.Context, address string) error { _, err := q.db.ExecContext(ctx, destroyEmail, address) return err } const getEmailByAddress = `-- name: GetEmailByAddress :one SELECT "address", "user_id", "created_at" FROM "public"."email" WHERE "address" = $1 ` func (q *Queries) GetEmailByAddress(ctx context.Context, address string) (Email, error) { row := q.db.QueryRowContext(ctx, getEmailByAddress, address) var i Email err := row.Scan(&i.Address, &i.UserID, &i.CreatedAt) return i, err } const getEmailByUserID = `-- name: GetEmailByUserID :one SELECT "address", "user_id", "created_at" FROM "public"."email" WHERE "user_id" = $1 ` func (q *Queries) GetEmailByUserID(ctx context.Context, userID int64) (Email, error) { row := q.db.QueryRowContext(ctx, getEmailByUserID, userID) var i Email err := row.Scan(&i.Address, &i.UserID, &i.CreatedAt) return i, err } const updateEmail = `-- name: UpdateEmail :exec UPDATE "email" SET ( "user_id", "created_at" ) = ( $1, $2 ) WHERE "address" = $3 ` type UpdateEmailParams struct { UserID int64 `json:"user_id"` CreatedAt time.Time `json:"created_at"` Address string `json:"address"` } func (q *Queries) UpdateEmail(ctx context.Context, arg UpdateEmailParams) error { _, err := q.db.ExecContext(ctx, updateEmail, arg.UserID, arg.CreatedAt, arg.Address) return err }