Added ogent for entity code gen.
This commit is contained in:
parent
9a92c4aad6
commit
196d34cc1f
29 changed files with 13445 additions and 12 deletions
29
ent/entc.go
Normal file
29
ent/entc.go
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
//go:build ignore
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"ariga.io/ogent"
|
||||
"entgo.io/contrib/entoas"
|
||||
"entgo.io/ent/entc"
|
||||
"entgo.io/ent/entc/gen"
|
||||
"github.com/ogen-go/ogen"
|
||||
)
|
||||
|
||||
func main() {
|
||||
spec := new(ogen.Spec)
|
||||
oas, err := entoas.NewExtension(entoas.Spec(spec))
|
||||
if err != nil {
|
||||
log.Fatalf("creating entoas extension: %v", err)
|
||||
}
|
||||
ogent, err := ogent.NewExtension(spec)
|
||||
if err != nil {
|
||||
log.Fatalf("creating ogent extension: %v", err)
|
||||
}
|
||||
err = entc.Generate("./schema", &gen.Config{}, entc.Extensions(ogent, oas))
|
||||
if err != nil {
|
||||
log.Fatalf("running ent codegen: %v", err)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue