feat: use postgres to fetch and store user info

This commit is contained in:
nihonium 2025-11-27 09:42:05 +03:00
parent 3528ea7d34
commit 40e0b14f2a
Signed by: nihonium
GPG key ID: 0251623741027CFC
9 changed files with 175 additions and 42 deletions

View file

@ -1,6 +1,9 @@
package main
import (
"context"
"fmt"
"os"
"time"
auth "nyanimedb/auth"
@ -9,14 +12,22 @@ import (
"github.com/gin-contrib/cors"
"github.com/gin-gonic/gin"
"github.com/jackc/pgx/v5/pgxpool"
)
var AppConfig Config
func main() {
// TODO: env args
r := gin.Default()
var queries *sqlc.Queries = nil
pool, err := pgxpool.New(context.Background(), os.Getenv("DATABASE_URL"))
if err != nil {
fmt.Fprintf(os.Stderr, "Unable to connect to database: %v\n", err)
os.Exit(1)
}
var queries *sqlc.Queries = sqlc.New(pool)
server := handlers.NewServer(queries)