aboutsummaryrefslogtreecommitdiff
path: root/server/database/items.go
diff options
context:
space:
mode:
authorMikunoNaka <bokuwakanojogahoshii@yahoo.com>2021-05-01 09:43:59 +0530
committerMikunoNaka <bokuwakanojogahoshii@yahoo.com>2021-05-01 09:43:59 +0530
commit45a3b94f133ebcd9abff2baf266d0b3f691d2790 (patch)
tree0716d12d6d25ead8b1905cd5b7ed70463c2fc458 /server/database/items.go
parent0fa16426f56120c4eb18bc18c202703c460daed8 (diff)
defined api group to handle DB functions regarding people/customers
Diffstat (limited to 'server/database/items.go')
-rw-r--r--server/database/items.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/server/database/items.go b/server/database/items.go
index d3d56fd..325b7c1 100644
--- a/server/database/items.go
+++ b/server/database/items.go
@@ -2,7 +2,6 @@
* OpenBills - Self hosted browser app to generate and keep track of simple invoices
* Version - 0
* Licensed under the MIT license - https://opensource.org/licenses/MIT
- *
* Copyright (c) 2021 Vidhu Kant Sharma
*/
@@ -27,7 +26,7 @@ type Item struct {
func GetAllItems() []Item {
var allItems []Item
rows, _ := myDatabase.Query(
- `SELECT model, desc, price, hsn, gst, category, brand FROM registered_items`,
+ `SELECT Model, Desc, Price, Hsn, Gst, Category, Brand FROM Items`,
)
var (
@@ -45,11 +44,11 @@ func GetAllItems() []Item {
}
func RegisterItem(item Item) bool {
- itemNames, _ := myDatabase.Query("SELECT model FROM registered_items")
+ itemNames, _ := myDatabase.Query("SELECT model FROM Items")
register_item, _ := myDatabase.Prepare(
- `INSERT INTO registered_items
- (model, desc, price, hsn, gst, category, brand)
+ `INSERT INTO Items
+ (Model, Desc, Price, Hsn, Gst, Category, Brand)
VALUES (?, ?, ?, ?, ?, ?, ?)`,
)
@@ -70,5 +69,6 @@ func RegisterItem(item Item) bool {
item.GST, item.Cat,
item.Brand,
)
+
return true
}