From 327a32f563394f92313e4a751515d69d90f4e7f5 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Sun, 12 Oct 2025 23:30:08 +0530 Subject: formatted code --- item/controller.go | 10 +++++----- item/item.go | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'item') diff --git a/item/controller.go b/item/controller.go index 3df95c3..26c6b8b 100644 --- a/item/controller.go +++ b/item/controller.go @@ -18,13 +18,13 @@ package item import ( - e "vidhukant.com/openbills/errors" "github.com/gin-gonic/gin" "net/http" "strconv" + e "vidhukant.com/openbills/errors" ) -func handleGetSingleItem (ctx *gin.Context) { +func handleGetSingleItem(ctx *gin.Context) { id, err := strconv.ParseUint(ctx.Param("id"), 10, 64) if err != nil { ctx.Error(e.ErrInvalidID) @@ -44,7 +44,7 @@ func handleGetSingleItem (ctx *gin.Context) { }) } -func handleGetItems (ctx *gin.Context) { +func handleGetItems(ctx *gin.Context) { var items []SavedItem err := getItems(&items) @@ -59,7 +59,7 @@ func handleGetItems (ctx *gin.Context) { }) } -func handleSaveItem (ctx *gin.Context) { +func handleSaveItem(ctx *gin.Context) { var item SavedItem ctx.Bind(&item) @@ -75,7 +75,7 @@ func handleSaveItem (ctx *gin.Context) { }) } -func handleDelItem (ctx *gin.Context) { +func handleDelItem(ctx *gin.Context) { id, err := strconv.ParseUint(ctx.Param("id"), 10, 64) if err != nil { ctx.Error(e.ErrInvalidID) diff --git a/item/item.go b/item/item.go index 3a6235f..108187a 100644 --- a/item/item.go +++ b/item/item.go @@ -23,6 +23,7 @@ import ( ) var db *gorm.DB + func init() { db = d.DB -- cgit v1.2.3