package
0.0.7
Repository: https://github.com/242617/core.git
Documentation: pkg.go.dev

# README

pipeline

Pipeline executes sequence of functions with simple syntax. It acts as a wrapper for calling functions.

Example:

errCh := make(chan error)
go pipeline.New(context.Background()).
    Before(func() { fmt.Println("1. before") }).
    Then(func(context.Context) error {
        fmt.Println("2. then")
        return errors.New("sample error")
    }).
    ThenCatch(func(err error) error {
        fmt.Println("3. then catch")
        return err
    }).
    Else(func(context.Context) error {
        fmt.Println("4. else")
        return errors.New("sample error")
    }).
    ElseCatch(func(err error) error {
        fmt.Println("5. else catch")
        return err
    }).
    After(func() { fmt.Println("6. after") }).
    Run(func(err error) {
        fmt.Println("7. run")
        errCh <- err
    })
fmt.Println(<-errCh)

# Functions

New creates pipeline that call functions in this order: - Before - Then - ThenCatch - Else - ElseCatch - Error - NoError - After - Run Example: errCh := make(chan error) go pipeline.New(context.Background()).
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author

# Type aliases

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author