add revenue now workd through shell command
This commit is contained in:
21
internal/database/currency.go
Normal file
21
internal/database/currency.go
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user