Convert to go

This commit is contained in:
2026-07-30 00:30:27 +02:00
parent 42fb4e90b4
commit 4518a4a363
35 changed files with 962 additions and 1797 deletions
+31
View File
@@ -0,0 +1,31 @@
package models
import (
"log"
"list_app/db"
)
type UserValue int
const (
Pass UserValue = iota + 1
OmdbKey
TwitchClientID
TwitchClientSecret
)
func GetValue(id UserValue) (string, bool) {
var value string
err := db.Pool.QueryRow("SELECT value FROM userData where id = ?;", int(id)).Scan(&value)
if err != nil {
log.Println(err)
return "", false
}
return value, true
}
func CheckPassword(pass string) bool {
password, ok := GetValue(Pass)
return ok && password != "" && pass == password
}