MCPcopy
hub / github.com/kashav/fsql / DoRun

Function DoRun

fsql_test.go:398–421  ·  view source on GitHub ↗

DoRun executes fsql.Run and returns the output.

(query string)

Source from the content-addressed store, hash-verified

396
397// DoRun executes fsql.Run and returns the output.
398func DoRun(query string) string {
399 stdout := os.Stdout
400 ch := make(chan string)
401
402 r, w, err := os.Pipe()
403 if err != nil {
404 return ""
405 }
406 os.Stdout = w
407
408 if err := Run(query); err != nil {
409 return ""
410 }
411
412 go func() {
413 var buf bytes.Buffer
414 io.Copy(&buf, r)
415 ch <- buf.String()
416 }()
417
418 w.Close()
419 os.Stdout = stdout
420 return <-ch
421}

Callers 7

TestRun_AllFunction · 0.85
TestRun_MultipleFunction · 0.85
TestRun_NameFunction · 0.85
TestRun_SizeFunction · 0.85
TestRun_TimeFunction · 0.85
TestRun_ModeFunction · 0.85
TestRun_HashFunction · 0.85

Calls 2

RunFunction · 0.70
StringMethod · 0.45

Tested by

no test coverage detected