Skip to content
/ pointer Public

A tool, that helps to create pointers on the fly

License

Notifications You must be signed in to change notification settings

spirin/pointer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pointer

A tool, that helps to create pointers on the fly.

For APIs, tests, etc

Usage:

import "github.com/spirin/pointer"

type Bar{}

func main() {
    pObj := pointer.Of(Bar{})
    
    pString := pointer.Of("some string")

    pIntA := pointer.Of(1)
    pIntB := pointer.Of(2)
    
    if pointer.Equal(pIntA, pIntB){
        ...
    }

    if pointer.EqualValue(pIntA, 123){
        ...
    }
    
    fmt.Println(pointer.Value(pIntB, 123))
    
    // types that cannot be autoresolved
    
    pInt64 := pointer.Int64(1)
    
    pFloat16 := pointer.Float16(1)
    
    ...
}

About

A tool, that helps to create pointers on the fly

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages