feat: common code for back functions are now in handlers/common.go
This commit is contained in:
parent
6ed47b667c
commit
6d538ed154
2 changed files with 29 additions and 11 deletions
|
|
@ -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{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue