redesign structure, add get endpoint
This commit is contained in:
parent
3dacf06005
commit
a216cc14dd
14 changed files with 176 additions and 77 deletions
14
internal/database/products.go
Normal file
14
internal/database/products.go
Normal file
|
@ -0,0 +1,14 @@
|
|||
package database
|
||||
|
||||
import "context"
|
||||
|
||||
func (d *Database) FindProductIDByBarcode(system string, barcode string) (id int, err error) {
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
err = d.db.QueryOne(ctx, &id, "SELECT id FROM products WHERE system = ? AND barcode = ?", system, barcode)
|
||||
if err != nil {
|
||||
return -1, err
|
||||
}
|
||||
return
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue