Files
2026-03-14 18:46:48 +01:00

35 lines
978 B
Go

package repository
import (
"context"
db "zardzul/music-index/sqlc"
"github.com/jackc/pgx/v5/pgtype"
)
type UserRepository interface {
CreateUser(ctx context.Context, arg db.CreateUserParams) (pgtype.UUID, error)
GetUsernameByID(ctx context.Context, id pgtype.UUID) (string, error)
GetUserAuthByEmail(ctx context.Context, mail string) (db.GetUserAuthByEmailRow, error)
}
type SQLCUserRepository struct {
q *db.Queries
}
func NewUserRepository(q *db.Queries) *SQLCUserRepository {
return &SQLCUserRepository{q: q}
}
func (r *SQLCUserRepository) CreateUser(ctx context.Context, arg db.CreateUserParams) (pgtype.UUID, error) {
return r.q.CreateUser(ctx, arg)
}
func (r *SQLCUserRepository) GetUsernameByID(ctx context.Context, id pgtype.UUID) (string, error) {
return r.q.GetUsernameByID(ctx, id)
}
func (r *SQLCUserRepository) GetUserAuthByEmail(ctx context.Context, email string) (db.GetUserAuthByEmailRow, error) {
return r.q.GetUserAuthByEmail(ctx, email)
}