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:
Ariel Mashraki
2019-09-08 08:03:43 -07:00
committed by Facebook Github Bot
parent 3fcaf80ca4
commit 61b8ccea4a
11 changed files with 149 additions and 23 deletions

View File

@@ -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 {