We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 86e8e43 commit 7b0ae9eCopy full SHA for 7b0ae9e
base/util.go
@@ -851,6 +851,12 @@ func LogLevelPtr(value LogLevel) *LogLevel {
851
return &value
852
}
853
854
+// Ptr returns a pointer to the given literal.
855
+// This is useful for wrapping around function calls that return a value, where you can't just use `&`.
856
+func Ptr[T any](v T) *T {
857
+ return &v
858
+}
859
+
860
// StringPtr returns a pointer to the given string literal.
861
func StringPtr(value string) *string {
862
0 commit comments