You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
624 B

  1. // Copyright 2017 The Gitea Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package util
  5. // OptionalBool a boolean that can be "null"
  6. type OptionalBool byte
  7. const (
  8. // OptionalBoolNone a "null" boolean value
  9. OptionalBoolNone = iota
  10. // OptionalBoolTrue a "true" boolean value
  11. OptionalBoolTrue
  12. // OptionalBoolFalse a "false" boolean value
  13. OptionalBoolFalse
  14. )
  15. // OptionalBoolOf get the corresponding OptionalBool of a bool
  16. func OptionalBoolOf(b bool) OptionalBool {
  17. if b {
  18. return OptionalBoolTrue
  19. }
  20. return OptionalBoolFalse
  21. }