Example: Raw SQL + joins
func ListUsers(c fiber.Ctx, db *gorm.DB) error {
cols := usersColumns()
q, err := fiberv3query.Extract(c, cols)
if err != nil {
return c.Status(400).JSON(fiber.Map{"error": err.Error()})
}
rows, pagination, err := postgresql.FindRaw[map[string]any](
db, q, cols, "users",
).
AddJoin("LEFT JOIN profiles p ON p.user_id = users.id").
AddWhere("users.deleted_at IS NULL").
Run()
if err != nil {
return c.Status(500).JSON(fiber.Map{"error": err.Error()})
}
datatable.FormatContent(&rows, cols)
return c.JSON(fiber.Map{
"data": rows,
"pagination": datatable.RenderPagination(pagination),
})
}
Row keys match column ID aliases (expr AS id).