forked from forgejo/forgejo
migrate some more "OptionalBool" to "Option[bool]" (#29479)
just some refactoring bits towards replacing **util.OptionalBool** with **optional.Option[bool]** --------- Co-authored-by: KN4CK3R <admin@oldschoolhack.me> (cherry picked from commit f6656181e4a07d6c415927220efa2077d509f7c6) Conflicts: models/repo/repo_list_test.go trivial shared fixture count conflicts
This commit is contained in:
parent
4127fcd608
commit
d3d70198b0
23 changed files with 183 additions and 174 deletions
|
@ -68,13 +68,13 @@ func OptionalBoolOf(b bool) OptionalBool {
|
|||
return OptionalBoolFalse
|
||||
}
|
||||
|
||||
// OptionalBoolParse get the corresponding OptionalBool of a string using strconv.ParseBool
|
||||
func OptionalBoolParse(s string) OptionalBool {
|
||||
b, e := strconv.ParseBool(s)
|
||||
// OptionalBoolParse get the corresponding optional.Option[bool] of a string using strconv.ParseBool
|
||||
func OptionalBoolParse(s string) optional.Option[bool] {
|
||||
v, e := strconv.ParseBool(s)
|
||||
if e != nil {
|
||||
return OptionalBoolNone
|
||||
return optional.None[bool]()
|
||||
}
|
||||
return OptionalBoolOf(b)
|
||||
return optional.Some(v)
|
||||
}
|
||||
|
||||
// IsEmptyString checks if the provided string is empty
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue