MCPcopy Index your code
hub / github.com/AlekSi/pointer

github.com/AlekSi/pointer @v1.2.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.2.0 ↗ · + Follow
94 symbols 239 edges 6 files 71 documented · 76% 23 cross-repo links
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

pointer

Go Reference

Go package pointer provides helpers to convert between pointers and values of built-in (and, with Go 1.18+ generics, of any) types.

go get github.com/AlekSi/pointer

API is stable. Documentation.

package motivationalexample

import (
    "encoding/json"

    "github.com/AlekSi/pointer"
)

const (
    defaultName = "some name"
)

// Stuff contains optional fields.
type Stuff struct {
    Name    *string
    Comment *string
    Value   *int64
    Time    *time.Time
}

// SomeStuff makes some JSON-encoded stuff.
func SomeStuff() (data []byte, err error) {
    return json.Marshal(&Stuff{
        Name:    pointer.ToString(defaultName),                                   // can't say &defaultName
        Comment: pointer.ToString("not yet"),                                     // can't say &"not yet"
        Value:   pointer.ToInt64(42),                                             // can't say &42 or &int64(42)
        Time:    pointer.ToTime(time.Date(2014, 6, 25, 12, 24, 40, 0, time.UTC)), // can't say &time.Date(…)
    })
}

Core symbols most depended-on inside this repo

ToString
called by 4
pointer.go
ToInt64
called by 3
pointer.go
ToTime
called by 3
pointer.go
GetBool
called by 2
value.go
GetByte
called by 2
value.go
GetComplex64
called by 2
value.go
GetComplex128
called by 2
value.go
GetError
called by 2
value.go

Shape

Function 93
Struct 1

Languages

Go100%

Modules by API surface

pointer_test.go24 symbols
value.go22 symbols
pointer_or_nil.go22 symbols
pointer.go22 symbols
generic.go3 symbols
generic_test.go1 symbols

For agents

$ claude mcp add pointer \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page