MCPcopy Index your code
hub / github.com/StudioSol/async

github.com/StudioSol/async @v1.0.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.0.0 ↗ · + Follow
21 symbols 66 edges 4 files 11 documented · 52%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Async

Build Status codecov Go Report Card GoDoc

Provides a safe way to execute functions asynchronously, recovering them in case of panic. It also provides an error stack aiming to facilitate fail causes discovery, and a simple way to control execution flow without WaitGroup.

Usage

var (
    user   User
    songs  []Songs
    photos []Photos
)

err := async.Run(ctx,
    func(ctx context.Context) error {
        user, err = user.Get(ctx, id)
        return err
    },
    func(ctx context.Context) error {
        songs, err = song.GetByUserID(ctx, id)
        return err
    },
    func(ctx context.Context) error {
        photos, err = photo.GetByUserID(ctx, id)
        return err
    },
)

if err != nil {
    log.Error(err)
}

You can also limit the number of asynchronous tasks

runner := async.NewRunner(tasks...).WithLimit(3)
if err := runner.Run(ctx); err != nil { 
    log.Error(e)
}

Extension points exported contracts — how you extend this code

Task (FuncType)
Task ...
async.go

Core symbols most depended-on inside this repo

NewRunner
called by 6
runner.go
Run
called by 6
runner.go
Run
called by 6
async.go
AllErrors
called by 3
runner.go
WaitErrors
called by 2
runner.go
registerErr
called by 2
runner.go
safePanic
called by 2
async.go
WithLimit
called by 1
runner.go

Shape

Function 14
Method 5
FuncType 1
Struct 1

Languages

Go100%

Modules by API surface

runner.go8 symbols
runner_test.go6 symbols
async.go5 symbols
async_test.go2 symbols

For agents

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

⬇ download graph artifact