-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
10d52d4
commit 38b86ef
Showing
6 changed files
with
40 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,28 @@ | ||
package starr | ||
|
||
// String returns a pointer to a string. | ||
func String(s string) *string { | ||
return &s | ||
// Ptr returns a pointer to the provided "whatever". | ||
func Ptr[P any](p P) *P { | ||
return &p | ||
} | ||
|
||
// True returns a pointer to a true boolean. | ||
func True() *bool { | ||
s := true | ||
return &s | ||
return Ptr(true) | ||
} | ||
|
||
// False returns a pointer to a false boolean. | ||
func False() *bool { | ||
s := false | ||
return Ptr(false) | ||
} | ||
|
||
// String returns a pointer to a string. | ||
// Deprecated: Use Ptr() function instead. | ||
func String(s string) *string { | ||
return &s | ||
} | ||
|
||
// Int64 returns a pointer to the provided integer. | ||
// Deprecated: Use Ptr() function instead. | ||
func Int64(s int64) *int64 { | ||
return &s | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters