Skip to content

Commit

Permalink
use samber/lo instead of private impl
Browse files Browse the repository at this point in the history
  • Loading branch information
gertd committed Mar 27, 2024
1 parent 9e7dd68 commit 7a1c0da
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions migrate/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func writeTypeInstance(w io.Writer, indent int, instance *dsc2.ObjectType, this
return
}

fmt.Fprintf(w, "%s%s:%s\n", space(indent), name, iff(this, " {}", ""))
fmt.Fprintf(w, "%s%s:%s\n", space(indent), name, lo.Ternary(this, " {}", ""))
}

func writeRelations(w io.Writer, indent int) {
Expand Down Expand Up @@ -143,10 +143,3 @@ func writePermissionInstance(w io.Writer, indent int, instances map[string]map[s
func space(count int) string {
return strings.Repeat(" ", count)
}

func iff[T any](condition bool, trueVal, falseVal T) T {
if condition {
return trueVal
}
return falseVal
}

0 comments on commit 7a1c0da

Please sign in to comment.