// Code generated by sqlc. DO NOT EDIT. // source: user_accounts.sql package pg import ( "context" "database/sql" "time" "github.com/google/uuid" ) const createUserAccount = `-- name: CreateUserAccount :one INSERT INTO user_account(full_name, initials, email, username, created_at, password_hash) VALUES ($1, $2, $3, $4, $5, $6) RETURNING user_id, created_at, email, username, password_hash, profile_bg_color, full_name, initials, profile_avatar_url ` type CreateUserAccountParams struct { FullName string `json:"full_name"` Initials string `json:"initials"` Email string `json:"email"` Username string `json:"username"` CreatedAt time.Time `json:"created_at"` PasswordHash string `json:"password_hash"` } func (q *Queries) CreateUserAccount(ctx context.Context, arg CreateUserAccountParams) (UserAccount, error) { row := q.db.QueryRowContext(ctx, createUserAccount, arg.FullName, arg.Initials, arg.Email, arg.Username, arg.CreatedAt, arg.PasswordHash, ) var i UserAccount err := row.Scan( &i.UserID, &i.CreatedAt, &i.Email, &i.Username, &i.PasswordHash, &i.ProfileBgColor, &i.FullName, &i.Initials, &i.ProfileAvatarUrl, ) return i, err } const deleteUserAccountByID = `-- name: DeleteUserAccountByID :exec DELETE FROM user_account WHERE user_id = $1 ` func (q *Queries) DeleteUserAccountByID(ctx context.Context, userID uuid.UUID) error { _, err := q.db.ExecContext(ctx, deleteUserAccountByID, userID) return err } const getAllUserAccounts = `-- name: GetAllUserAccounts :many SELECT user_id, created_at, email, username, password_hash, profile_bg_color, full_name, initials, profile_avatar_url FROM user_account ` func (q *Queries) GetAllUserAccounts(ctx context.Context) ([]UserAccount, error) { rows, err := q.db.QueryContext(ctx, getAllUserAccounts) if err != nil { return nil, err } defer rows.Close() var items []UserAccount for rows.Next() { var i UserAccount if err := rows.Scan( &i.UserID, &i.CreatedAt, &i.Email, &i.Username, &i.PasswordHash, &i.ProfileBgColor, &i.FullName, &i.Initials, &i.ProfileAvatarUrl, ); err != nil { return nil, err } items = append(items, i) } if err := rows.Close(); err != nil { return nil, err } if err := rows.Err(); err != nil { return nil, err } return items, nil } const getUserAccountByID = `-- name: GetUserAccountByID :one SELECT user_id, created_at, email, username, password_hash, profile_bg_color, full_name, initials, profile_avatar_url FROM user_account WHERE user_id = $1 ` func (q *Queries) GetUserAccountByID(ctx context.Context, userID uuid.UUID) (UserAccount, error) { row := q.db.QueryRowContext(ctx, getUserAccountByID, userID) var i UserAccount err := row.Scan( &i.UserID, &i.CreatedAt, &i.Email, &i.Username, &i.PasswordHash, &i.ProfileBgColor, &i.FullName, &i.Initials, &i.ProfileAvatarUrl, ) return i, err } const getUserAccountByUsername = `-- name: GetUserAccountByUsername :one SELECT user_id, created_at, email, username, password_hash, profile_bg_color, full_name, initials, profile_avatar_url FROM user_account WHERE username = $1 ` func (q *Queries) GetUserAccountByUsername(ctx context.Context, username string) (UserAccount, error) { row := q.db.QueryRowContext(ctx, getUserAccountByUsername, username) var i UserAccount err := row.Scan( &i.UserID, &i.CreatedAt, &i.Email, &i.Username, &i.PasswordHash, &i.ProfileBgColor, &i.FullName, &i.Initials, &i.ProfileAvatarUrl, ) return i, err } const updateUserAccountProfileAvatarURL = `-- name: UpdateUserAccountProfileAvatarURL :one UPDATE user_account SET profile_avatar_url = $2 WHERE user_id = $1 RETURNING user_id, created_at, email, username, password_hash, profile_bg_color, full_name, initials, profile_avatar_url ` type UpdateUserAccountProfileAvatarURLParams struct { UserID uuid.UUID `json:"user_id"` ProfileAvatarUrl sql.NullString `json:"profile_avatar_url"` } func (q *Queries) UpdateUserAccountProfileAvatarURL(ctx context.Context, arg UpdateUserAccountProfileAvatarURLParams) (UserAccount, error) { row := q.db.QueryRowContext(ctx, updateUserAccountProfileAvatarURL, arg.UserID, arg.ProfileAvatarUrl) var i UserAccount err := row.Scan( &i.UserID, &i.CreatedAt, &i.Email, &i.Username, &i.PasswordHash, &i.ProfileBgColor, &i.FullName, &i.Initials, &i.ProfileAvatarUrl, ) return i, err }