example3

package
v0.0.0-...-69e4c68 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2020 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Complete

type Complete func(p Promise, err error)

Complete callback for Then

type GenericPromise

type GenericPromise struct {
	// contains filtered or unexported fields
}

GenericPromise struct for adding to other objects

func (GenericPromise) Repl

func (p GenericPromise) Repl() chan Promise

Repl channel

func (*GenericPromise) Super

func (p *GenericPromise) Super()

Super constructs yourself. Must be called by child implementations

func (*GenericPromise) Then

func (p *GenericPromise) Then(ctx context.Context, call Complete)

Then call the function on itself

type MyPromise

type MyPromise struct {
	GenericPromise
	// contains filtered or unexported fields
}

MyPromise of local data

type Open

type Open func() Promise

Open creates the promise

func MyPromiseConstructor

func MyPromiseConstructor(i int) Open

MyPromiseConstructor can construct promises of type MyPromise

type Processor

type Processor func(pr Promise)

Processor callback for the promise to be acted on

type Promise

type Promise interface {
	Then(ctx context.Context, call Complete)
	Repl() chan Promise
}

Promise is something that does async work

type Promiser

type Promiser chan Promise

Promiser takes requests and returns promises

func (Promiser) Request

func (p Promiser) Request(open Open) Promise

Request something

func (Promiser) Run

func (p Promiser) Run(ctx context.Context, work Processor)

Run the processor for the Promiser

Jump to

Keyboard shortcuts

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