diff options
| author | Vidhu Kant Sharma <vidhukant@vidhukant.com> | 2025-10-12 23:28:54 +0530 | 
|---|---|---|
| committer | Vidhu Kant Sharma <vidhukant@vidhukant.com> | 2025-10-12 23:28:54 +0530 | 
| commit | 029fe2c7a3532bc3bf435f257cdade240c8f3568 (patch) | |
| tree | e4b0488af6b867e3065a11af8d706d139c7176a9 /item/service.go | |
| parent | fd863aadf34b9837bd77587c1d36eb49000a8de7 (diff) | |
added get single item routev0.21.0
Diffstat (limited to 'item/service.go')
| -rw-r--r-- | item/service.go | 15 | 
1 files changed, 15 insertions, 0 deletions
diff --git a/item/service.go b/item/service.go index b7d3490..7a622cb 100644 --- a/item/service.go +++ b/item/service.go @@ -21,6 +21,21 @@ import (  	"vidhukant.com/openbills/errors"  ) +func getItem(item *SavedItem, id uint) error { +	res := db.Find(&item, id) + +	// TODO: handle potential errors +	if res.Error != nil { +		return res.Error +	} + +	if res.RowsAffected == 0 { +		return errors.ErrNotFound +	} + +	return nil +} +  func getItems(items *[]SavedItem) error {  	res := db.Find(&items)  |