[PD1] Fixed stuff. Unmarshal still returns map[string]interface{}, need to fix
This commit is contained in:
parent
c131aa2aea
commit
39a0e5c01f
6 changed files with 127 additions and 96 deletions
|
@ -154,3 +154,22 @@ func (ds DataStore) GetUserCertificate(uid string) protocol.Packet {
|
|||
}
|
||||
return protocol.NewSendUserCertPacket(uid, userCert)
|
||||
}
|
||||
|
||||
func userExists(db *sql.DB, uid string) bool {
|
||||
// Prepare the SQL statement for checking if a user exists
|
||||
query := `
|
||||
SELECT COUNT(*)
|
||||
FROM users
|
||||
WHERE UID = ?
|
||||
`
|
||||
|
||||
var count int
|
||||
// Execute the SQL query
|
||||
err := db.QueryRow(query, uid).Scan(&count)
|
||||
if err != nil {
|
||||
log.Panicln("Error checking if user exists")
|
||||
}
|
||||
|
||||
// If count is greater than 0, the user exists
|
||||
return count > 0
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue