model.go 638 B

1234567891011121314151617181920212223242526272829
  1. // Copyright 2021 Frédéric Guillot. All rights reserved.
  2. // Use of this source code is governed by the Apache 2.0
  3. // license that can be found in the LICENSE file.
  4. package model // import "miniflux.app/model"
  5. // OptionalString populates an optional string field.
  6. func OptionalString(value string) *string {
  7. if value != "" {
  8. return &value
  9. }
  10. return nil
  11. }
  12. // OptionalInt populates an optional int field.
  13. func OptionalInt(value int) *int {
  14. if value > 0 {
  15. return &value
  16. }
  17. return nil
  18. }
  19. // OptionalInt64 populates an optional int64 field.
  20. func OptionalInt64(value int64) *int64 {
  21. if value > 0 {
  22. return &value
  23. }
  24. return nil
  25. }