goo_context

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

README

goo-context

Cancel

func main() {
    for {
        select {
        case <-goo_context.Cancel().Done():
            goo_log.Debug("exit")
            return

        default:
            goo_log.Debug(time.Now().Format("15:04:05"))
            time.Sleep(time.Second)
        }
    }
}

Timeout

func main() {
    ctx := goo_context.Timeout(5 * time.Second)
    	
    for {
        select {
        case <-ctx.Done():
            goo_log.Debug("exit")
            return

        default:
            goo_log.Debug(time.Now().Format("15:04:05"))
            time.Sleep(time.Second)
        }
    }
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cancel

func Cancel() context.Context

func Timeout

func Timeout(d time.Duration, v ...map[string]interface{}) context.Context

Types

This section is empty.

Jump to

Keyboard shortcuts

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