A bit more cleanup into an api to use before testing out authentication.

This commit is contained in:
Zed A. Shaw 2025-06-09 00:37:56 -04:00
parent 55f59d88b6
commit 8c04bffa5d
2 changed files with 15 additions and 7 deletions

View file

@ -37,7 +37,7 @@ func GetJson[T any](db *sqlx.DB, c *fiber.Ctx, err error, sql string, args ...in
return c.JSON(&result);
}
func GetThing[T any](c *fiber.Ctx) (*T, error) {
func ReceivePost[T any](c *fiber.Ctx) (*T, error) {
var result *T
result = new(T)
@ -57,3 +57,12 @@ func GetThing[T any](c *fiber.Ctx) (*T, error) {
return result, nil
}
func Insert(db *sqlx.DB, err error, sql string, args ...interface{}) error {
if err != nil {
log.Println(err)
return err
}
return db.MustExec(sql, args...)
}