MCPcopy Create free account
hub / github.com/deuill/go-php / Bind

Method Bind

engine/context.go:41–54  ·  view source on GitHub ↗

Bind allows for binding Go values into the current execution context under a certain name. Bind returns an error if attempting to bind an invalid value (check the documentation for NewValue for what is considered to be a "valid" value).

(name string, val interface{})

Source from the content-addressed store, hash-verified

39// (check the documentation for NewValue for what is considered to be a "valid"
40// value).
41func (c *Context) Bind(name string, val interface{}) error {
42 v, err := NewValue(val)
43 if err != nil {
44 return err
45 }
46
47 n := C.CString(name)
48 defer C.free(unsafe.Pointer(n))
49
50 C.context_bind(c.context, n, v.Ptr())
51 c.values = append(c.values, v)
52
53 return nil
54}
55
56// Exec executes a PHP script pointed to by filename in the current execution
57// context, and returns an error, if any. Output produced by the script is

Callers 1

TestContextBindFunction · 0.95

Calls 2

PtrMethod · 0.95
NewValueFunction · 0.85

Tested by 1

TestContextBindFunction · 0.76