otto

package
v0.0.0-...-30e45d9 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2017 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertOttoToGo

func ConvertOttoToGo(value interface{}) interface{}

ConvertOttoToGo ...

func GetAuthorization

func GetAuthorization(value otto.Value) (schema.Authorization, error)

GetAuthorization gets Transaction from otto value

func GetBool

func GetBool(value otto.Value) (bool, error)

GetBool gets bool from otto value

func GetInt64

func GetInt64(value otto.Value) (result int64, err error)

GetInt64 gets int64 from otto value

func GetList

func GetList(value otto.Value) ([]interface{}, error)

GetList gets []interface{} from otto value

func GetMap

func GetMap(value otto.Value) (map[string]interface{}, error)

GetMap gets map[string]interface{} from otto value

func GetString

func GetString(value otto.Value) (string, error)

GetString gets string from otto value

func GetStringList

func GetStringList(value otto.Value) ([]string, error)

GetStringList gets []string from otto value

func GetTransaction

func GetTransaction(value otto.Value) (transaction.Transaction, error)

GetTransaction gets Transaction from otto value

func GohanDbCreate

func GohanDbCreate(transaction transaction.Transaction, needCommit bool, schemaID string,
	dataMap map[string]interface{}) (*schema.Resource, error)

GohanDbCreate adds resource to database

func GohanDbDelete

func GohanDbDelete(transaction transaction.Transaction, needCommit bool, schemaID, ID string) error

GohanDbDelete deletes resource from database

func GohanDbFetch

func GohanDbFetch(tx transaction.Transaction, schemaID, ID,
	tenantID string) (*schema.Resource, error)

GohanDbFetch gets resource from database

func GohanDbList

func GohanDbList(transaction transaction.Transaction, schemaID string,
	filter map[string]interface{}, key string, limit uint64, offset uint64) ([]map[string]interface{}, error)

GohanDbList lists resources in database filtered by filter and paginator

func GohanDbMakeColumns

func GohanDbMakeColumns(schemaID string) ([]string, error)

GohanDbMakeColumns creates columns for given resource in database

func GohanDbQuery

func GohanDbQuery(transaction transaction.Transaction, needCommit bool, schemaID,
	sqlString string, arguments []interface{}) ([]map[string]interface{}, error)

GohanDbQuery get resources from database with query

func GohanDbStateFetch

func GohanDbStateFetch(tx transaction.Transaction, schemaID, ID,
	tenantID string) (map[string]interface{}, error)

GohanDbStateFetch gets resource's state from database

func GohanDbStateUpdate

func GohanDbStateUpdate(transaction transaction.Transaction, needCommit bool, schemaID string,
	dataMap map[string]interface{}) (*schema.Resource, error)

GohanDbStateUpdate updates resource's state in database

func GohanDbUpdate

func GohanDbUpdate(transaction transaction.Transaction, needCommit bool, schemaID string,
	dataMap map[string]interface{}) (*schema.Resource, error)

GohanDbUpdate updates resource in database

func GohanModelCreate

func GohanModelCreate(context map[string]interface{}, schemaID string,
	dataMap map[string]interface{}) (interface{}, error)

GohanModelCreate creates gohan resource and running extensions

func GohanModelDelete

func GohanModelDelete(context map[string]interface{}, schemaID string, resourceID string) error

GohanModelDelete deletes gohan resources and running extensions

func GohanModelFetch

func GohanModelFetch(context map[string]interface{}, schemaID string, resourceID string,
	tenantIDs []string) (interface{}, error)

GohanModelFetch fetch gohan resource and running extensions

func GohanModelList

func GohanModelList(context map[string]interface{}, schemaID string,
	filterMap map[string]interface{}) (interface{}, error)

GohanModelList lists gohan resources and running extensions

func GohanModelUpdate

func GohanModelUpdate(context map[string]interface{}, schemaID string, resourceID string, dataMap map[string]interface{}, tenantIDs []string) (interface{}, error)

GohanModelUpdate updates gohan resource and running extensions

func PushJSLogModule

func PushJSLogModule(env *Environment, newModule string) (restore func())

PushJSLogModule appends newModule to log module in env, returns a function that restores the original value

func RegisterInit

func RegisterInit(init func(env *Environment))

RegisterInit registers init code

func RegisterModule

func RegisterModule(name string, module interface{})

RegisterModule registers modules

func RequireModule

func RequireModule(name string) (interface{}, error)

RequireModule returns module

func ThrowOttoException

func ThrowOttoException(call *otto.FunctionCall, format string, arguments ...interface{})

ThrowOttoException throws a JavaScript exception that will be passed to Otto

func VerifyCallArguments

func VerifyCallArguments(call *otto.FunctionCall, functionName string, expectedArgumentsCount int)

VerifyCallArguments verify number of calles

Types

type Environment

type Environment struct {
	Name      string
	VM        *motto.Motto
	DataStore db.DB

	Identity middleware.IdentityService
	Sync     sync.Sync
	// contains filtered or unexported fields
}

Environment javascript based environment for gohan extension

func NewEnvironment

func NewEnvironment(name string, dataStore db.DB, identity middleware.IdentityService,
	timelimit time.Duration, sync sync.Sync) *Environment

NewEnvironment create new gohan extension environment based on context

func (*Environment) ClearEnvironment

func (env *Environment) ClearEnvironment()

func (*Environment) Clone

func (env *Environment) Clone() ext.Environment

Clone makes clone of the environment

func (*Environment) GetOrCreateTransaction

func (env *Environment) GetOrCreateTransaction(value otto.Value) (transaction.Transaction, bool, error)

GetOrCreateTransaction gets transaction from otto value or creates new is otto value is null

func (*Environment) HandleEvent

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

HandleEvent handles event

func (*Environment) Load

func (env *Environment) Load(source, code string) error

Load loads script for environment

func (*Environment) LoadExtensionsForPath

func (env *Environment) LoadExtensionsForPath(extensions []*schema.Extension, path string) error

LoadExtensionsForPath loads extensions for specific path

func (*Environment) RegisterObject

func (env *Environment) RegisterObject(objectID string, object interface{})

RegisterObject register new object for VM

func (*Environment) SetUp

func (env *Environment) SetUp()

SetUp initialize environment

Jump to

Keyboard shortcuts

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