mirror of
https://github.com/ent/ent.git
synced 2026-05-01 07:00:57 +03:00
Reviewed By: alexsn Differential Revision: D17599268 fbshipit-source-id: 2d89229e1880a0c33ff26c89d52205981a5cfbab
489 B
Executable File
489 B
Executable File
id, title
| id | title |
|---|---|
| schema-config | Config |
Custom Table Name
A custom table name can be provided for types using the Table option as follows:
package schema
import (
"github.com/facebookincubator/ent"
"github.com/facebookincubator/ent/schema/field"
)
type User struct {
ent.Schema
}
func (User) Config() ent.Config {
return ent.Config{
Table: "Users",
}
}
func (User) Fields() []ent.Field {
return []ent.Field{
field.Int("age"),
field.String("name"),
}
}