retry

package module
v0.0.0-...-959150f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 23, 2019 License: Apache-2.0 Imports: 1 Imported by: 0

README

go-retry

Retry func if err

package main

import (
    retry "github.com/9glt/go-retry"
)

func main() {

    var data string
    err := retry.Run(func(r int) error {
        var err error
        data, err = myfunc()
        return err
    }, 3, time.Second)

    if err != nil {
        panic(err)
    }
    println(data)
}

func myfunc() (string, error) {
    return "hi", nil
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(fn func(r int) error, count int, delay time.Duration) error

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL