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{})
| 39 | // (check the documentation for NewValue for what is considered to be a "valid" |
| 40 | // value). |
| 41 | func (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 |