Moved NewVariable to top

Moved NewVariable above the receiver methods
This commit is contained in:
Winni Neessen 2024-09-11 11:26:58 +02:00
parent 270111e53f
commit 7f2cf28053
Signed by: wneessen
GPG key ID: 385AC9889632126E

View file

@ -51,11 +51,6 @@ type Variable[T any] struct {
present bool present bool
} }
// IsNil returns true when a Variable is nil
func (v *Variable[T]) IsNil() bool {
return !v.notNil
}
// NewVariable returns a new Variable of generic type // NewVariable returns a new Variable of generic type
func NewVariable[T any](value T) Variable[T] { func NewVariable[T any](value T) Variable[T] {
return Variable[T]{ return Variable[T]{
@ -64,6 +59,11 @@ func NewVariable[T any](value T) Variable[T] {
} }
} }
// IsNil returns true when a Variable is nil
func (v *Variable[T]) IsNil() bool {
return !v.notNil
}
// NotNil returns true when a Variable is not nil // NotNil returns true when a Variable is not nil
func (v *Variable[T]) NotNil() bool { func (v *Variable[T]) NotNil() bool {
return v.notNil return v.notNil