Skip to content

Instantly share code, notes, and snippets.

@BK1031
Created July 10, 2024 00:21
Show Gist options
  • Save BK1031/ece4a2b11fc3a85e409de755caaa3f24 to your computer and use it in GitHub Desktop.
Save BK1031/ece4a2b11fc3a85e409de755caaa3f24 to your computer and use it in GitHub Desktop.
racecar_analytics create ecu/battery functions
func CreateECU(ecu ECU) (ECU, error) {
result := DB.Create(&ecu)
if result.Error != nil {
return ECU{}, result.Error
}
return ecu, nil
}
func CreateBattery(battery Battery) (Battery, error) {
result := DB.Create(&battery)
if result.Error != nil {
return Battery{}, result.Error
}
return battery, nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment