mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
Reviewed By: idoshveki Differential Revision: D16600425 fbshipit-source-id: 04c6fe39f9b3b628a1e79eb3063188f582d9e504
35 lines
629 B
Go
35 lines
629 B
Go
package schema
|
|
|
|
import (
|
|
"fbc/ent"
|
|
"fbc/ent/field"
|
|
)
|
|
|
|
// User holds the schema definition for the User entity.
|
|
type User struct {
|
|
ent.Schema
|
|
}
|
|
|
|
// Fields of the User.
|
|
func (User) Fields() []ent.Field {
|
|
return []ent.Field{
|
|
// changing the type of the field.
|
|
field.Int("age"),
|
|
// extending name field to longtext.
|
|
field.Text("name"),
|
|
// adding new columns.
|
|
field.String("phone"),
|
|
field.Bytes("buffer").
|
|
Default([]byte("{}")),
|
|
// deleting the address column.
|
|
}
|
|
}
|
|
|
|
// Additional types to be added to the schema.
|
|
type (
|
|
// Pet schema.
|
|
Pet struct{ ent.Schema }
|
|
// Group schema.
|
|
Group struct{ ent.Schema }
|
|
)
|