mirror of
https://github.com/zhigang1992/graphql-engine.git
synced 2026-06-14 09:39:09 +08:00
Co-authored-by: Rishichandra Wawhal <rishichandra.wawhal@gmail.com> Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com> Co-authored-by: Aravind <aravindkp@outlook.in> Co-authored-by: Anon Ray <ecthiender@users.noreply.github.com> Co-authored-by: Shahidh K Muhammed <muhammedshahid.k@gmail.com>
27 lines
473 B
Go
27 lines
473 B
Go
package cliextension
|
|
|
|
import (
|
|
"io/ioutil"
|
|
"os"
|
|
)
|
|
|
|
func writeCLIExtInput(data []byte) (string, error) {
|
|
file, err := ioutil.TempFile("", "*.json")
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
err = ioutil.WriteFile(file.Name(), data, os.ModePerm)
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
return file.Name(), nil
|
|
}
|
|
|
|
func readCliExtOutput(filename string) ([]byte, error) {
|
|
fileBytes, err := ioutil.ReadFile(filename)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return fileBytes, nil
|
|
}
|