53 lines
1.5 KiB
Go
53 lines
1.5 KiB
Go
package db
|
|
|
|
type BasicProfile struct {
|
|
CompanyId int
|
|
Employees string
|
|
Revenue string
|
|
Applications string
|
|
Compliance string
|
|
Industry string
|
|
ITDependency string
|
|
DataSensitivity string
|
|
DataVolume string
|
|
NetworkSegmentation string
|
|
LegacySystems string
|
|
IoTIntegration string
|
|
RemoteWork string
|
|
BYOD string
|
|
VPN string
|
|
API string
|
|
VendorAccess string
|
|
InternalDev string
|
|
}
|
|
|
|
// InsertBasicProfile inserts a new record into the BasicProfile table
|
|
func InsertBasicProfile(profile BasicProfile) (int, error) {
|
|
query := `
|
|
INSERT INTO BasicProfile (
|
|
CompanyId, Employees, Revenue, Applications, Compliance, Industry, ITDependency, DataSensitivity, DataVolume,
|
|
NetworkSegmentation, LegacySystems, IoTIntegration, RemoteWork, BYOD, VPN, API, VendorAccess, InternalDev
|
|
) 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.Employees, profile.Revenue, profile.Applications, profile.Compliance, profile.Industry,
|
|
profile.ITDependency, profile.DataSensitivity, profile.DataVolume, profile.NetworkSegmentation, profile.LegacySystems,
|
|
profile.IoTIntegration, profile.RemoteWork, profile.BYOD, profile.VPN, profile.API, profile.VendorAccess, profile.InternalDev,
|
|
).Scan(&id)
|
|
|
|
if err != nil {
|
|
return -1, err
|
|
}
|
|
|
|
return id, nil
|
|
}
|