initial setup, messing around with sqlc

This commit is contained in:
zardzul
2026-03-10 20:22:07 +01:00
parent 9f9054e53b
commit 5fa23b0d1c
11 changed files with 332 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.30.0
// source: users.sql
package database
import (
"context"
"github.com/jackc/pgx/v5/pgtype"
)
const getUsernameByID = `-- name: GetUsernameByID :one
SELECT user_name FROM users WHERE id = $1
`
// users.sql
func (q *Queries) GetUsernameByID(ctx context.Context, id pgtype.UUID) (string, error) {
row := q.db.QueryRow(ctx, getUsernameByID, id)
var user_name string
err := row.Scan(&user_name)
return user_name, err
}
const checkUserExistsByEmail = `-- name: checkUserExistsByEmail :one
SELECT id FROM users WHERE user_mail = $1
`
func (q *Queries) checkUserExistsByEmail(ctx context.Context, userMail string) (pgtype.UUID, error) {
row := q.db.QueryRow(ctx, checkUserExistsByEmail, userMail)
var id pgtype.UUID
err := row.Scan(&id)
return id, err
}