(res *core.Result)
| 133 | } |
| 134 | |
| 135 | func fromResult(res *core.Result) map[string]interface{} { |
| 136 | sql := res.SQL() |
| 137 | sqlFn := js.FuncOf(func(this js.Value, args []js.Value) interface{} { |
| 138 | return sql |
| 139 | }) |
| 140 | |
| 141 | data := string(res.Data) |
| 142 | dataFn := js.FuncOf(func(this js.Value, args []js.Value) interface{} { |
| 143 | return js.Global().Get("JSON").Call("parse", data) |
| 144 | }) |
| 145 | |
| 146 | hash := res.Hash |
| 147 | hashFn := js.FuncOf(func(this js.Value, args []js.Value) interface{} { |
| 148 | return hex.EncodeToString(hash[:]) |
| 149 | }) |
| 150 | |
| 151 | return map[string]interface{}{ |
| 152 | "sql": sqlFn, |
| 153 | "data": dataFn, |
| 154 | "hash": hashFn, |
| 155 | "role": res.Role(), |
| 156 | } |
| 157 | } |
| 158 | |
| 159 | func fromMember(m *core.Member) map[string]interface{} { |
| 160 | dataFn := js.FuncOf(func(this js.Value, args []js.Value) interface{} { |
no test coverage detected