- Simplified the conversion of 'readable' and 'built_in' fields to boolean values by utilizing a new toBool function, enhancing code readability and maintainability. - Removed debug SQL print statements from the Update method to clean up the output and improve performance.
23 lines
349 B
Go
23 lines
349 B
Go
package io
|
|
|
|
// toBool converts various types to boolean
|
|
func toBool(v interface{}) bool {
|
|
if v == nil {
|
|
return false
|
|
}
|
|
|
|
switch val := v.(type) {
|
|
case bool:
|
|
return val
|
|
case int:
|
|
return val == 1
|
|
case int64:
|
|
return val == 1
|
|
case float64:
|
|
return val == 1
|
|
case string:
|
|
return val == "1" || val == "true"
|
|
default:
|
|
return false
|
|
}
|
|
}
|