Files
ent/entc/load/template/main.tmpl
Ariel Mashraki 2c8b5a65b7 entc: abandon plugins
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
2019-08-01 05:07:48 -07:00

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 }}