2018-08-14 15:48:41 +03:00
|
|
|
// +build ignore
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2019-07-09 14:22:59 +03:00
|
|
|
"io/ioutil"
|
|
|
|
"log"
|
|
|
|
"os"
|
2018-08-14 15:48:41 +03:00
|
|
|
|
2019-07-09 14:22:59 +03:00
|
|
|
"github.com/99designs/gqlgen/api"
|
|
|
|
"github.com/99designs/gqlgen/codegen/config"
|
|
|
|
"github.com/pkg/errors"
|
2018-08-14 15:48:41 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
fmt.Println("Generating graphql code ...")
|
|
|
|
|
2019-07-09 14:22:59 +03:00
|
|
|
log.SetOutput(ioutil.Discard)
|
|
|
|
|
|
|
|
cfg, err := config.LoadConfigFromDefaultLocations()
|
|
|
|
if os.IsNotExist(errors.Cause(err)) {
|
|
|
|
cfg = config.DefaultConfig()
|
|
|
|
} else if err != nil {
|
|
|
|
_, _ = fmt.Fprintln(os.Stderr, err.Error())
|
|
|
|
os.Exit(2)
|
|
|
|
}
|
|
|
|
|
|
|
|
if err = api.Generate(cfg); err != nil {
|
|
|
|
_, _ = fmt.Fprintln(os.Stderr, err.Error())
|
|
|
|
os.Exit(3)
|
|
|
|
}
|
2018-08-14 15:48:41 +03:00
|
|
|
}
|