Derefer
Helper routines for simplifying the dereferencing of pointers of basic type.
Install / Use
/learn @xorcare/DereferREADME
derefer
Package derefer contains helper routines for simplifying the getting of optional fields of basic type. This allows you to get the value from the pointer even if it is nil, because in this case the zero value of the specified type will be received.
Installation
go get github.com/xorcare/derefer
Examples
Examples of using the library are presented on godoc.org and in the source library code.
FAQ
| Question | Source |
| -------- | ------ |
| How to dereference bool pointer from a struct literal or variable? | var _ bool = derefer.Bool(new(bool)) |
| How to dereference byte pointer from a struct literal or variable? | var _ byte = derefer.Byte(new(byte)) |
| How to dereference complex64 pointer from a struct literal or variable? | var _ complex64 = derefer.Complex64(new(complex64)) |
| How to dereference complex128 pointer from a struct literal or variable? | var _ complex128 = derefer.Complex128(new(complex128)) |
| How to dereference float32 pointer from a struct literal or variable? | var _ float32 = derefer.Float32(new(float32)) |
| How to dereference float64 pointer from a struct literal or variable? | var _ float64 = derefer.Float64(new(float64)) |
| How to dereference int pointer from a struct literal or variable? | var _ int = derefer.Int(new(int)) |
| How to dereference int8 pointer from a struct literal or variable? | var _ int8 = derefer.Int8(new(int8)) |
| How to dereference int16 pointer from a struct literal or variable? | var _ int16 = derefer.Int16(new(int16)) |
| How to dereference int32 pointer from a struct literal or variable? | var _ int32 = derefer.Int32(new(int32)) |
| How to dereference int64 pointer from a struct literal or variable? | var _ int64 = derefer.Int64(new(int64)) |
| How to dereference rune pointer from a struct literal or variable? | var _ rune = derefer.Rune(new(rune)) |
| How to dereference string pointer from a struct literal or variable? | var _ string = derefer.String(new(string)) |
| How to dereference uint pointer from a struct literal or variable? | var _ uint = derefer.Uint(new(uint)) |
| How to dereference uint8 pointer from a struct literal or variable? | var _ uint8 = derefer.Uint8(new(uint8)) |
| How to dereference uint16 pointer from a struct literal or variable? | var _ uint16 = derefer.Uint16(new(uint16)) |
| How to dereference uint32 pointer from a struct literal or variable? | var _ uint32 = derefer.Uint32(new(uint32)) |
| How to dereference uint64 pointer from a struct literal or variable? | var _ uint64 = derefer.Uint64(new(uint64)) |
| How to dereference uintptr pointer from a struct literal or variable? | var _ uintptr = derefer.Uintptr(new(uintptr)) |
License
© Vasiliy Vasilyuk, 2019
Released under the BSD 3-Clause License.
Related Skills
node-connect
346.8kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
xurl
346.8kA CLI tool for making authenticated requests to the X (Twitter) API. Use this skill when you need to post tweets, reply, quote, search, read posts, manage followers, send DMs, upload media, or interact with any X API v2 endpoint.
frontend-design
107.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
346.8kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
