17 lines
371 B
Go
17 lines
371 B
Go
package service
|
|
|
|
import (
|
|
"Portifolio/internal/model"
|
|
"database/sql"
|
|
|
|
_ "github.com/mattn/go-sqlite3"
|
|
)
|
|
|
|
func AddCompany(input model.CompanyInput, db *sql.DB) error {
|
|
_, err := db.Exec(
|
|
`INSERT INTO companies (name, shares_outstanding, price, currency_id) VALUES (?, ?, ?, ?)`,
|
|
input.Name, input.SharesOutstanding, input.Price, input.CurrencyID,
|
|
)
|
|
return err
|
|
}
|