(t iterator, v interface{})
| 246 | } |
| 247 | |
| 248 | func asString(t iterator, v interface{}) string { |
| 249 | switch v := v.(type) { |
| 250 | case nil: |
| 251 | return "" |
| 252 | case bool: |
| 253 | if v { |
| 254 | return "true" |
| 255 | } |
| 256 | return "false" |
| 257 | case float64: |
| 258 | return strconv.FormatFloat(v, 'g', -1, 64) |
| 259 | case string: |
| 260 | return v |
| 261 | case query: |
| 262 | node := v.Select(t) |
| 263 | if node == nil { |
| 264 | return "" |
| 265 | } |
| 266 | return node.Value() |
| 267 | default: |
| 268 | panic(fmt.Errorf("unexpected type: %T", v)) |
| 269 | } |
| 270 | } |
| 271 | |
| 272 | // booleanFunc is a XPath functions boolean([node-set]). |
| 273 | func booleanFunc(arg1 query) func(query, iterator) interface{} { |
no test coverage detected
searching dependent graphs…