canape/backend/models/utils.go
Lucas BEE 7c2f368b04
All checks were successful
continuous-integration/drone/push Build is passing
Cleanup movies handling
Do not delete fields about a movie when we already have them
Movie has no UserID field
2020-04-06 18:16:28 +02:00

20 lines
313 B
Go

package models
func updateIfNonEmpty(old *string, newValue string) {
if newValue != "" {
*old = newValue
}
}
func updateIfNonZeroInt(old *int, newValue int) {
if newValue != 0 {
*old = newValue
}
}
func updateIfNonZeroFloat(old *float32, newValue float32) {
if newValue != 0. {
*old = newValue
}
}