model.go 495 B

123456789101112131415161718192021
  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. }