Documentation ¶
Index ¶
- func ConvertOttoToGo(value interface{}) interface{}
- func GetAuthorization(value otto.Value) (schema.Authorization, error)
- func GetBool(value otto.Value) (bool, error)
- func GetInt64(value otto.Value) (result int64, err error)
- func GetList(value otto.Value) ([]interface{}, error)
- func GetMap(value otto.Value) (map[string]interface{}, error)
- func GetString(value otto.Value) (string, error)
- func GetStringList(value otto.Value) ([]string, error)
- func GetTransaction(value otto.Value) (transaction.Transaction, error)
- func GohanDbCreate(transaction transaction.Transaction, needCommit bool, schemaID string, ...) (*schema.Resource, error)
- func GohanDbDelete(transaction transaction.Transaction, needCommit bool, schemaID, ID string) error
- func GohanDbFetch(tx transaction.Transaction, schemaID, ID, tenantID string) (*schema.Resource, error)
- func GohanDbList(transaction transaction.Transaction, schemaID string, ...) ([]map[string]interface{}, error)
- func GohanDbMakeColumns(schemaID string) ([]string, error)
- func GohanDbQuery(transaction transaction.Transaction, needCommit bool, ...) ([]map[string]interface{}, error)
- func GohanDbStateFetch(tx transaction.Transaction, schemaID, ID, tenantID string) (map[string]interface{}, error)
- func GohanDbStateUpdate(transaction transaction.Transaction, needCommit bool, schemaID string, ...) (*schema.Resource, error)
- func GohanDbUpdate(transaction transaction.Transaction, needCommit bool, schemaID string, ...) (*schema.Resource, error)
- func GohanModelCreate(context map[string]interface{}, schemaID string, ...) (interface{}, error)
- func GohanModelDelete(context map[string]interface{}, schemaID string, resourceID string) error
- func GohanModelFetch(context map[string]interface{}, schemaID string, resourceID string, ...) (interface{}, error)
- func GohanModelList(context map[string]interface{}, schemaID string, ...) (interface{}, error)
- func GohanModelUpdate(context map[string]interface{}, schemaID string, resourceID string, ...) (interface{}, error)
- func PushJSLogModule(env *Environment, newModule string) (restore func())
- func RegisterInit(init func(env *Environment))
- func RegisterModule(name string, module interface{})
- func RequireModule(name string) (interface{}, error)
- func ThrowOttoException(call *otto.FunctionCall, format string, arguments ...interface{})
- func VerifyCallArguments(call *otto.FunctionCall, functionName string, expectedArgumentsCount int)
- type Environment
- func (env *Environment) ClearEnvironment()
- func (env *Environment) Clone() ext.Environment
- func (env *Environment) GetOrCreateTransaction(value otto.Value) (transaction.Transaction, bool, error)
- func (env *Environment) HandleEvent(event string, context map[string]interface{}) (err error)
- func (env *Environment) Load(source, code string) error
- func (env *Environment) LoadExtensionsForPath(extensions []*schema.Extension, path string) error
- func (env *Environment) RegisterObject(objectID string, object interface{})
- func (env *Environment) SetUp()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAuthorization ¶
func GetAuthorization(value otto.Value) (schema.Authorization, error)
GetAuthorization gets Transaction from otto value
func GetStringList ¶
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 ¶
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 ¶
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 RegisterModule ¶
func RegisterModule(name string, module interface{})
RegisterModule registers modules
func RequireModule ¶
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