miniflux/internal/model/model.go

23 lines
417 B
Go
Raw Normal View History

// SPDX-FileCopyrightText: Copyright The Miniflux Authors. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
package model // import "miniflux.app/v2/internal/model"
type Number interface {
int | int64 | float64
}
2021-01-04 22:49: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
}
func OptionalString(value string) *string {
if value != "" {
return &value
}
return nil
}