package db import ( "database/sql" "errors" "strings" "github.com/google/uuid" ) type AuthDb interface { InsertUser(userIs uuid.UUID, email string, password string) error } type AuthDbSqlite struct { db *sql.DB } func (a *AuthDbSqlite) InsertUser(userId uuid.UUID, email string, passwordHash []byte, salt []byte) error { _, err := a.db.Exec("INSERT INTO user (user_uuid, email, email_verified, is_admin, password, salt, created_at) VALUES (?, ?, FALSE, FALSE, ?, ?, datetime())", userId, email, passwordHash, salt) if err != nil { if strings.Contains(err.Error(), "email") { return errors.New("Bad Request") } utils.LogError("Could not insert user", err) return ErrInternalServer } }