small refactor*

This commit is contained in:
royalcat 2025-03-22 08:49:14 +04:00
parent b6b541e050
commit 24a4d30275
232 changed files with 2164 additions and 1906 deletions
server/cmd/generate-graphql-schema

View 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())
}