https://github.com/gotidy/ptr
Contains functions for simplified creation of pointers from constants of basic types
https://github.com/gotidy/ptr
go golang golang-library golang-package pointers ptr
Last synced: 6 months ago
JSON representation
Contains functions for simplified creation of pointers from constants of basic types
- Host: GitHub
- URL: https://github.com/gotidy/ptr
- Owner: gotidy
- License: apache-2.0
- Created: 2019-12-25T15:29:48.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-06-06T13:21:55.000Z (almost 2 years ago)
- Last Synced: 2024-06-18T18:45:29.720Z (11 months ago)
- Topics: go, golang, golang-library, golang-package, pointers, ptr
- Language: Go
- Homepage:
- Size: 21.5 KB
- Stars: 25
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-go-extra - ptr - 12-25T15:29:48Z|2021-12-18T17:01:29Z| (Utilities / Fail injection)
README
# ptr [](https://godoc.org/github.com/gotidy/ptr) [](https://goreportcard.com/report/github.com/gotidy/ptr) [](https://github.com/avelino/awesome-go)
`ptr` contains functions for simplified creation of pointers from constants of basic types.
Support for generics has been implemented since version 1.4.0. Required 1.18 or later version of Go.
## Installation
`go get github.com/gotidy/ptr`
## Examples
This code:
```go
p := ptr.Of(10)
```is the equivalent for:
```go
i := int(10)
p := &i
```## Documentation
[GoDoc](http://godoc.org/github.com/gotidy/ptr)
## License
[Apache 2.0](https://github.com/gotidy/ptr/blob/master/LICENSE)