feat: common code for back functions are now in handlers/common.go

This commit is contained in:
Iron_Felix 2025-11-01 21:17:42 +03:00
parent 6ed47b667c
commit 6d538ed154
2 changed files with 29 additions and 11 deletions

View file

@ -4,24 +4,23 @@ import (
"context"
oapi "nyanimedb/api"
sqlc "nyanimedb/sql"
"strconv"
"github.com/jackc/pgx/v5"
"github.com/oapi-codegen/runtime/types"
)
type Server struct {
db *sqlc.Queries
}
// type Server struct {
// db *sqlc.Queries
// }
func NewServer(db *sqlc.Queries) Server {
return Server{db: db}
}
// func NewServer(db *sqlc.Queries) Server {
// return Server{db: db}
// }
func parseInt64(s string) (int32, error) {
i, err := strconv.ParseInt(s, 10, 64)
return int32(i), err
}
// func parseInt64(s string) (int32, error) {
// i, err := strconv.ParseInt(s, 10, 64)
// return int32(i), err
// }
func mapUser(u sqlc.GetUserByIDRow) oapi.User {
return oapi.User{