A bit more cleanup into an api to use before testing out authentication.
This commit is contained in:
parent
55f59d88b6
commit
8c04bffa5d
2 changed files with 15 additions and 7 deletions
|
@ -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...)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue