mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
Summary: Go plugin is not a good solution for both internal and external usage. It's hard to manage and maintain matching versions (both Go and external libraries), and it does not support Windows. Reviewed By: alexsn Differential Revision: D16582217 fbshipit-source-id: 81876d2c6f30bbfc16ecf9e5000f0670f2e62484
41 lines
669 B
Cheetah
41 lines
669 B
Cheetah
{{ define "main" }}
|
|
// Code generated by 'entc generate'. DO NOT EDIT.
|
|
package main
|
|
|
|
import (
|
|
"os"
|
|
"bytes"
|
|
{{ template "imports" }}
|
|
|
|
{{ printf "%q" .Package }}
|
|
)
|
|
|
|
{{ $base := base .Package}}
|
|
|
|
var schemas = []ent.Schema{
|
|
{{ range $_, $name := .Names }}
|
|
{{- $base }}.{{- printf "%s{Schema: ent.DefaultSchema}" $name }},
|
|
{{ end -}}
|
|
}
|
|
|
|
func main() {
|
|
var lines [][]byte
|
|
for _, schema := range schemas {
|
|
b, err := MarshalSchema(schema)
|
|
if err != nil {
|
|
fail(err)
|
|
}
|
|
lines = append(lines, b)
|
|
}
|
|
os.Stdout.Write(bytes.Join(lines, []byte("\n")))
|
|
}
|
|
|
|
func fail(err error) {
|
|
os.Stderr.WriteString(err.Error())
|
|
os.Exit(1)
|
|
}
|
|
|
|
{{ template "schema" }}
|
|
|
|
{{ end }}
|