Logo

0x5a.live

for different kinds of informations and explorations.

GitHub - StudioSol/async: 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.

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. - StudioSol/async

Visit SiteGitHub - StudioSol/async: 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.

GitHub - StudioSol/async: 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.

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. - StudioSol/async

Powered by 0x5a.live ๐Ÿ’—

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)
}

GoLang Resources

are all listed below.

Resources

listed to get explored on!!

Made with โค๏ธ

to provide different kinds of informations and resources.