small refactor*
This commit is contained in:
parent
b6b541e050
commit
24a4d30275
232 changed files with 2164 additions and 1906 deletions
server/cmd/generate-graphql-schema
27
server/cmd/generate-graphql-schema/main.go
Normal file
27
server/cmd/generate-graphql-schema/main.go
Normal file
|
@ -0,0 +1,27 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
graph "git.kmsign.ru/royalcat/tstor/server/src/delivery/graphql"
|
||||
"github.com/vektah/gqlparser/v2/formatter"
|
||||
)
|
||||
|
||||
func main() {
|
||||
outFile := "schema.graphql"
|
||||
|
||||
if len(os.Args) > 1 {
|
||||
outFile = os.Args[1]
|
||||
}
|
||||
|
||||
file, err := os.OpenFile(outFile, os.O_CREATE|os.O_RDWR|os.O_TRUNC, os.ModePerm)
|
||||
if err != nil {
|
||||
log.Panic(fmt.Errorf("Failed to open %s: %w", outFile, err))
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
fmt := formatter.NewFormatter(file)
|
||||
fmt.FormatSchema(graph.NewExecutableSchema(graph.Config{}).Schema())
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue