add revenue now workd through shell command

This commit is contained in:
samantha42
2026-03-24 21:31:01 +01:00
parent 7e2c332e60
commit 63be7b9282
13 changed files with 200 additions and 78 deletions

View File

@@ -0,0 +1,21 @@
package database
import (
"Portifolio/internal/model"
"database/sql"
"fmt"
_ "github.com/mattn/go-sqlite3"
)
func GetCurrencyByID(db *sql.DB, ID int) (model.Currency, error) {
var c model.Currency
err := db.QueryRow(
`SELECT id, code, name, FROM currencies WHERE id = ?`,
ID,
).Scan(&c.ID, &c.Code, &c.Name)
if err == sql.ErrNoRows {
return c, fmt.Errorf("company %d not found", ID)
}
return c, nil
}