SUrvey now works
This commit is contained in:
43
db/advancedProfile.go
Normal file
43
db/advancedProfile.go
Normal file
@@ -0,0 +1,43 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user