Open
Description
- The issue is present in the latest release.
- I have searched the issues of this repository and believe that this is not a duplicate.
Current Behavior 😯
func (User) Fields() []ent.Field {
return []ent.Field{
field.UUID("id", uuid.UUID{}).
Unique().
Immutable().
Default(uuid.New). // This works
Annotations(entproto.Field(1)),
field.String("name").
DefaultFunc(randstr). // This not work.
Annotations(entproto.Field(2)),
field.Time("created_at").
Immutable().
Default(time.Now). // This not work.
Annotations(entproto.Field(2)),
}
}
This happens because generated code (func (x *XService) createBuilder
) calls m.SetXXX(v)
even if v
is the zero value.
Expected Behavior 🤔
Fucntion given by DefaultFunc
or Default
must be invoked and the result must be set as a field value.
Steps to Reproduce 🕹
Steps:
- Genreate gRPC services with Create RPC.
- Call Create.
Your Environment 🌎
Tech | Version |
---|---|
Go | 1.22.3 |
Ent | 0.12.5 |
Database | sliqte3 |
Driver | mem |
Metadata
Metadata
Assignees
Labels
No labels