MCPcopy Index your code
hub / github.com/akmittal/turbo-go

github.com/akmittal/turbo-go @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
26 symbols 61 edges 9 files 9 documented · 35%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Turbo-go

Build hotwire applications using Go

Example

Examples are in examples directory

Install turbo-go

go get github.com/akmittal/turbo-go

API

github.com/akmittal/turbo-go/pkg/turbo

Send single template update

messageTemp, err := template.New("message").parse(`

{{.}}

`)
data := time.Now()
turbo := turbo.Turbo{
        Action:   turbo.APPEND, // Action can be UPDATE, APPEND, PREPEND, REPLACE, REMOVE
        Template: messageTemp,
        Target:   "messages",
        Data:     data,
    }

Send stream of templates

func main(){
    // Create hub
    hub := turbo.NewHub()
    go hub.Run()
    mux.Get("/socket", func(rw http.ResponseWriter, req *http.Request) {
        getSocket(msgChan, hub, rw, req)
    })
}

func getSocket(msgChan chan interface{}, hub *turbo.Hub, rw http.ResponseWriter, req *http.Request) {
    temp, _ := template.ParseFiles("templates/messages.temp.html")
    messageTemp := temp.Lookup("message")

    appendMessage := turbo.Stream{
        Action:   turbo.APPEND,
        Template: messageTemp,
        Target:   "messages",
        Data:     msgChan,
    }

    appendMessage.Stream(hub, rw, req)
}


Core symbols most depended-on inside this repo

NewHub
called by 2
pkg/turbo/hub.go
Run
called by 2
pkg/turbo/hub.go
Stream
called by 2
pkg/turbo/stream.go
WrapTemplateInTurbo
called by 2
internal/util/util.go
Send
called by 1
pkg/turbo/turbo.go
sendSocket
called by 1
pkg/turbo/turbo.go
writePump
called by 1
pkg/turbo/client.go
getSocket
called by 1
examples/timestamp/main.go

Shape

Function 12
Method 7
Struct 6
TypeAlias 1

Languages

Go100%

Modules by API surface

pkg/turbo/turbo.go5 symbols
examples/timestamp/main.go4 symbols
examples/hotwire/main.go4 symbols
pkg/turbo/hub.go3 symbols
pkg/turbo/update.go2 symbols
pkg/turbo/stream.go2 symbols
pkg/turbo/client.go2 symbols
internal/util/util.go2 symbols
examples/hotwire/message/message.go2 symbols

For agents

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

⬇ download graph artifact