extension

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2018 License: Apache-2.0 Imports: 6 Imported by: 19

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearManager

func ClearManager()

ClearManager clears manager

func HandleEvent

func HandleEvent(context map[string]interface{}, environment Environment, event string, schemaID string) error

HandleEvent handles the event in the given environment

Types

type Environment

type Environment interface {
	LoadExtensionsForPath(extensions []*schema.Extension, timeLimit time.Duration, timeLimits []*schema.PathEventTimeLimit, path string) error
	HandleEvent(event string, context map[string]interface{}) error
	Clone() Environment
	IsEventHandled(event string, context map[string]interface{}) bool
}

Environment is a interface for extension environment

type Error

type Error struct {
	ExceptionInfo map[string]interface{}
	// contains filtered or unexported fields
}

Error is created when a problem has occurred during event handling. It contains the information required to reraise the javascript exception that caused this error.

func Errorf

func Errorf(code int, name, message string) Error

Errorf makes extension error

type Manager

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

Manager takes care of mapping schemas to Environments. This is a singleton class.

func GetManager

func GetManager() *Manager

GetManager gets manager

func (*Manager) GetEnvironment

func (manager *Manager) GetEnvironment(schemaID string) (env Environment, ok bool)

GetEnvironment returns the environment registered for the given schema ID

func (*Manager) HandleEventInAllEnvironments

func (manager *Manager) HandleEventInAllEnvironments(context map[string]interface{}, event string, schemaID string) error

HandleEventInAllEnvironments handles the event in all registered environments

func (*Manager) RegisterEnvironment

func (manager *Manager) RegisterEnvironment(schemaID string, env Environment) error

RegisterEnvironment registers a new environment for the given schema ID

func (*Manager) UnRegisterEnvironment

func (manager *Manager) UnRegisterEnvironment(schemaID string) error

UnRegisterEnvironment removes an environment registered for the given schema ID

type MultiEnvironment

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

MultiEnvironment can handle multiple environment

func NewEnvironment

func NewEnvironment(envs []Environment) *MultiEnvironment

NewEnvironment create new gohan extension environment based on context

func (*MultiEnvironment) Clone

func (env *MultiEnvironment) Clone() Environment

Clone makes clone of the environment

func (*MultiEnvironment) HandleEvent

func (env *MultiEnvironment) HandleEvent(event string, context map[string]interface{}) error

HandleEvent handles event

func (*MultiEnvironment) IsEventHandled

func (env *MultiEnvironment) IsEventHandled(event string, context map[string]interface{}) bool

IsEventHandled returns whether a given event is handled by this environment

func (*MultiEnvironment) LoadExtensionsForPath

func (env *MultiEnvironment) LoadExtensionsForPath(extensions []*schema.Extension, timeLimit time.Duration, timeLimits []*schema.PathEventTimeLimit, path string) error

LoadExtensionsForPath for returns extensions for specific path

func (*MultiEnvironment) SetUp

func (env *MultiEnvironment) SetUp()

SetUp initialize environment

Directories

Path Synopsis
Package goext is a generated GoMock package.
Package goext is a generated GoMock package.
lib

Jump to

Keyboard shortcuts

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