scope

package
v0.0.0-...-a532a67 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: LGPL-3.0 Imports: 17 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDoned = errors.New("context scope is done")

ErrDoned is the error returned by ContextScope.AddTasks when the context scope is done.

Functions

func CorrlationID

func CorrlationID(task string) (cid string)

func GetBool

func GetBool(scp app.DataScope, name string) (value bool, err error)

GetBool get bool value from data scope

func GetComplex128

func GetComplex128(scp app.DataScope, name string) (value complex128, err error)

GetComplex128 get complex128 value from data scope

func GetComplex64

func GetComplex64(scp app.DataScope, name string) (value complex64, err error)

GetComplex64 get complex64 value from data scope

func GetFloat32

func GetFloat32(scp app.DataScope, name string) (value float32, err error)

GetFloat32 get float32 value from data scope

func GetFloat64

func GetFloat64(scp app.DataScope, name string) (value float64, err error)

GetFloat64 get float64 value from data scope

func GetInt

func GetInt(scp app.DataScope, name string) (value int, err error)

GetInt get int value from data scope

func GetInt64

func GetInt64(scp app.DataScope, name string) (value int64, err error)

GetInt64 get int value from data scope

func GetString

func GetString(scp app.DataScope, name string) (value string, err error)

GetString get string value from data scope

func GetUint

func GetUint(scp app.DataScope, name string) (value uint, err error)

GetUint get uint value from data scope

func GetUint64

func GetUint64(scp app.DataScope, name string) (value uint64, err error)

GetUint64 get uint64 value from data scope

func New

func New(params Params) app.Scope

New create new instance of scope

func NewChild

func NewChild(parent app.Scope, params ChildParams) app.Scope

NewChild create new instance of child scope

Types

type ChildParams

type ChildParams struct {
	ContextScope app.ContextScope
	DataScope    app.DataScope
	EventScope   app.EventScope
	Injector     app.Injector
	Name         string
	CID          string
}

ChildParams describe child scope

type Params

type Params struct {
	ContextScope app.ContextScope
	DataScope    app.DataScope
	EventScope   app.EventScope
	Injector     app.Injector
	CID          string
	Name         string
}

Params describe scope

type Scope

type Scope struct {
	app.ContextScope
	app.DataScope
	app.EventScope
	app.Injector
	// contains filtered or unexported fields
}

Scope is global scope interface

func (*Scope) AddTasks

func (scp *Scope) AddTasks(delta int) (err error)

AddTasks add task to wait group

func (*Scope) AppendError

func (scp *Scope) AppendError(errs ...error)

AppendError add an error to the scope

func (*Scope) BaseContextScope

func (scp *Scope) BaseContextScope() app.ContextScope

BaseContextScope return unwrap ContextScope object (help better utilize/recycle objects)

func (*Scope) BaseDataScope

func (scp *Scope) BaseDataScope() app.DataScope

BaseDataScope return unwrap DataScope object (help better utilize/recycle objects)

func (*Scope) BaseEventScope

func (scp *Scope) BaseEventScope() app.EventScope

BaseEventScope return unwrap EventScope object (help better utilize/recycle objects)

func (*Scope) BaseInjector

func (scp *Scope) BaseInjector() app.Injector

BaseInjector return unwrap dependency injector object (help better utilize/recycle objects)

func (*Scope) CID

func (scp *Scope) CID() string

CID return correlation id (it is used to track multi machine tasks)

func (*Scope) Close

func (scp *Scope) Close() (err error)

Close scope

func (*Scope) DoneTask

func (scp *Scope) DoneTask()

DoneTask mark single task as done

func (*Scope) Err

func (scp *Scope) Err() error

Err return cumulative error if the scope context contains any error

func (*Scope) GoContext

func (scp *Scope) GoContext() context.Context

GoContext return golang context object

func (*Scope) Kill

func (scp *Scope) Kill()

Kill scope

func (*Scope) SID

func (scp *Scope) SID() string

SID return scope id

func (*Scope) Stop

func (scp *Scope) Stop()

Stop scope

func (*Scope) Wait

func (scp *Scope) Wait() error

Wait for finish of context execution

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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