MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / GetUserFunction

Method GetUserFunction

db/functions.go:64–71  ·  view source on GitHub ↗

DATABASE API FOR USER FUNCTIONS: Looks up a UserFunction by name and returns an Invocation.

(ctx context.Context, name string, args map[string]interface{}, mutationAllowed bool)

Source from the content-addressed store, hash-verified

62
63// Looks up a UserFunction by name and returns an Invocation.
64func (db *Database) GetUserFunction(ctx context.Context, name string, args map[string]interface{}, mutationAllowed bool) (UserFunctionInvocation, error) {
65 if db.Options.UserFunctions != nil {
66 if fn, found := db.Options.UserFunctions.Definitions[name]; found {
67 return fn.Invoke(db, args, mutationAllowed, ctx)
68 }
69 }
70 return nil, missingError(db.User(), "function", name)
71}
72
73// Calls a user function by name, returning all the results at once.
74func (db *Database) CallUserFunction(ctx context.Context, name string, args map[string]interface{}, mutationAllowed bool) (interface{}, error) {

Callers 6

CallUserFunctionMethod · 0.95
handleFunctionCallMethod · 0.80
handleFunctionMethod · 0.80
testUserQueriesCommonFunction · 0.80
testUserQueriesAsAdminFunction · 0.80
testUserQueriesAsUserFunction · 0.80

Calls 3

UserMethod · 0.95
missingErrorFunction · 0.85
InvokeMethod · 0.65

Tested by 3

testUserQueriesCommonFunction · 0.64
testUserQueriesAsAdminFunction · 0.64
testUserQueriesAsUserFunction · 0.64