Add initial database setup and user/artist management functionality
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
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)
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user