Skip to content

Commit

Permalink
Add Ptr function to common
Browse files Browse the repository at this point in the history
A new function Ptr has been added to common/cond.go. This function returns address of any type of object that is passed as an argument to it. This enhancement will be useful in many scenarios where pointer to an object is required.
  • Loading branch information
nekohasekai committed Dec 10, 2023
1 parent e23ecbb commit 7026a5d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions common/cond.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,10 @@ func DefaultValue[T any]() T {
return defaultValue
}

func Ptr[T any](obj T) *T {
return &obj
}

func Close(closers ...any) error {
var retErr error
for _, closer := range closers {
Expand Down

0 comments on commit 7026a5d

Please sign in to comment.