Files
old-riskletpy/db/advancedProfile.go
2024-11-17 19:41:30 +01:00

44 lines
1.3 KiB
Go

package db
type AdvancedProfile struct {
CompanyId int
GeographicDistribution string
CustomerConcentration string
ProductServicePortfolio string
OrganizationalCulture string
SupplierDiversity string
TechnologicalInfrastructure string
IntellectualProperty string
ManagementTeamExperience string
}
// InsertAdvancedProfile inserts a new record into the AdvancedProfile table
func InsertAdvancedProfile(profile AdvancedProfile) (int, error) {
query := `
INSERT INTO AdvancedProfile (
CompanyId, GeographicDistribution, CustomerConcentration, ProductServicePortfolio, OrganizationalCulture,
SupplierDiversity, TechnologicalInfrastructure, IntellectualProperty, ManagementTeamExperience
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
RETURNING id
`
stmt, err := db.Prepare(query)
if err != nil {
return -2, err
}
defer stmt.Close()
id := 0
err = stmt.QueryRow(
profile.CompanyId, profile.GeographicDistribution, profile.CustomerConcentration, profile.ProductServicePortfolio,
profile.OrganizationalCulture, profile.SupplierDiversity, profile.TechnologicalInfrastructure, profile.IntellectualProperty,
profile.ManagementTeamExperience,
).Scan(&id)
if err != nil {
return -1, err
}
return id, nil
}