2023-06-19 23:42:47 +02:00
|
|
|
// SPDX-FileCopyrightText: Copyright The Miniflux Authors. All rights reserved.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
2021-01-04 06:20:21 +01:00
|
|
|
|
2023-08-11 04:46:45 +02:00
|
|
|
package model // import "miniflux.app/v2/internal/model"
|
2021-01-04 06:20:21 +01:00
|
|
|
|
2024-03-17 20:03:28 +01:00
|
|
|
type Number interface {
|
|
|
|
int | int64 | float64
|
2021-01-04 06:20:21 +01:00
|
|
|
}
|
2021-01-04 22:49:28 +01:00
|
|
|
|
2024-03-17 20:03:28 +01:00
|
|
|
func OptionalNumber[T Number](value T) *T {
|
2021-01-04 22:49:28 +01:00
|
|
|
if value > 0 {
|
|
|
|
return &value
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
2024-03-16 14:20:02 +01:00
|
|
|
|
2024-03-17 20:03:28 +01:00
|
|
|
func OptionalString(value string) *string {
|
|
|
|
if value != "" {
|
2024-03-16 14:20:02 +01:00
|
|
|
return &value
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|