mirror of
https://github.com/ent/ent.git
synced 2026-05-22 09:31:45 +03:00
examples: add ent init --template example
This commit is contained in:
committed by
Ariel Mashraki
parent
0066eb986d
commit
24d1fad3b8
25
examples/entcpkg/ent/template/entinit.tmpl
Normal file
25
examples/entcpkg/ent/template/entinit.tmpl
Normal file
@@ -0,0 +1,25 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/mixin"
|
||||
)
|
||||
|
||||
// {{ . }} holds the schema definition for the {{ . }} entity.
|
||||
type {{ . }} struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
// Mixins of the {{ . }}.
|
||||
func ({{ . }}) Mixins() []ent.Mixin {
|
||||
return []ent.Mixin{
|
||||
mixin.Time{},
|
||||
}
|
||||
}
|
||||
|
||||
// Fields of the {{ . }}.
|
||||
func ({{ . }}) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
// Fields go here.
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user