mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
entc/load: enable adding additional fields to the generated entities
Summary: In some cases (like xwf auth service), you want to add additional fields to the generated model. Reviewed By: alexsn Differential Revision: D17223674 fbshipit-source-id: fb4be71b388c6bd107e6bac242133c237fe25599
This commit is contained in:
committed by
Facebook Github Bot
parent
3fcaf80ca4
commit
61b8ccea4a
10
entc/load/testdata/valid/schema.go
vendored
10
entc/load/testdata/valid/schema.go
vendored
@@ -5,6 +5,9 @@
|
||||
package valid
|
||||
|
||||
import (
|
||||
"log"
|
||||
"sync"
|
||||
|
||||
"github.com/facebookincubator/ent"
|
||||
"github.com/facebookincubator/ent/schema/field"
|
||||
)
|
||||
@@ -12,6 +15,13 @@ import (
|
||||
// User holds the user schema.
|
||||
type User struct {
|
||||
ent.Schema
|
||||
|
||||
// add additional struct-only
|
||||
// fields to the generated model.
|
||||
Tenant string `json:"tenant,omitempty"`
|
||||
Logger *log.Logger // Comment.
|
||||
sync.Mutex
|
||||
Ignored ent.Interface // Ignored comment.
|
||||
}
|
||||
|
||||
func (User) Fields() []ent.Field {
|
||||
|
||||
Reference in New Issue
Block a user