package main import ( "context" "log" "photum-backend/internal/config" "github.com/jackc/pgx/v5/pgxpool" ) func main() { cfg := config.LoadConfig() pool, err := pgxpool.New(context.Background(), cfg.DBDsn) if err != nil { log.Fatalf("Failed to connect: %v", err) } defer pool.Close() // Check if it exists and what region var id, regiao, fot string var empresaID, cursoID, anoIDStr string err = pool.QueryRow(context.Background(), "SELECT id, fot, regiao, empresa_id, curso_id, ano_formatura_id FROM cadastro_fot WHERE fot = '2222'").Scan(&id, &fot, ®iao, &empresaID, &cursoID, &anoIDStr) if err != nil { log.Printf("Error finding FOT 2222: %v", err) } else { log.Printf("Found FOT 2222: ID=%s, Regiao=%s", id, regiao) log.Printf(" EmpresaID: %s", empresaID) log.Printf(" CursoID: %s", cursoID) log.Printf(" AnoID: %s", anoIDStr) } // LIST ALL to see what regions exist rows, _ := pool.Query(context.Background(), "SELECT fot, regiao FROM cadastro_fot ORDER BY created_at DESC LIMIT 10") defer rows.Close() log.Println("--- Recent FOTs ---") for rows.Next() { var f, r string rows.Scan(&f, &r) log.Printf("FOT: %s, Regiao: %s", f, r) } }