()
| 31 | ) |
| 32 | |
| 33 | func main() { |
| 34 | tmpDir, err := os.MkdirTemp("", "dnote-schema-gen-*") |
| 35 | if err != nil { |
| 36 | fmt.Fprintf(os.Stderr, "Error: %v\n", err) |
| 37 | os.Exit(1) |
| 38 | } |
| 39 | defer os.RemoveAll(tmpDir) |
| 40 | |
| 41 | schemaPath := filepath.Join("pkg", "cli", "database", "schema.sql") |
| 42 | |
| 43 | if err := run(tmpDir, schemaPath); err != nil { |
| 44 | fmt.Fprintf(os.Stderr, "Error: %v\n", err) |
| 45 | os.Exit(1) |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | func run(tmpDir, outputPath string) error { |
| 50 | schema, err := generateSchema(tmpDir) |