2023-06-19 17:42:47 -04:00
|
|
|
// SPDX-FileCopyrightText: Copyright The Miniflux Authors. All rights reserved.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
2021-01-04 00:20:21 -05:00
|
|
|
|
2023-08-10 22:46:45 -04:00
|
|
|
package model // import "miniflux.app/v2/internal/model"
|
2021-01-04 00:20:21 -05:00
|
|
|
|
|
|
|
// OptionalString populates an optional string field.
|
|
|
|
func OptionalString(value string) *string {
|
|
|
|
if value != "" {
|
|
|
|
return &value
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// OptionalInt populates an optional int field.
|
|
|
|
func OptionalInt(value int) *int {
|
|
|
|
if value > 0 {
|
|
|
|
return &value
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
2021-01-04 16:49:28 -05:00
|
|
|
|
|
|
|
// OptionalInt64 populates an optional int64 field.
|
|
|
|
func OptionalInt64(value int64) *int64 {
|
|
|
|
if value > 0 {
|
|
|
|
return &value
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|