mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
Summary: Pull Request resolved: https://github.com/facebookexternal/fbc/pull/1338 Pull Request resolved: https://github.com/facebookincubator/ent/pull/14 Reviewed By: alexsn Differential Revision: D16890825 fbshipit-source-id: 656baaa73f5debab08c849b6b9639caeec2a8ef1
30 lines
445 B
Go
30 lines
445 B
Go
package base
|
|
|
|
import (
|
|
"github.com/facebookincubator/ent"
|
|
"github.com/facebookincubator/ent/schema/field"
|
|
)
|
|
|
|
// base schema for sharing fields and edges.
|
|
type base struct {
|
|
ent.Schema
|
|
}
|
|
|
|
func (base) Fields() []ent.Field {
|
|
return []ent.Field{
|
|
field.Int("base_field"),
|
|
}
|
|
}
|
|
|
|
// User holds the user schema.
|
|
type User struct {
|
|
base
|
|
}
|
|
|
|
func (u User) Fields() []ent.Field {
|
|
return append(
|
|
u.base.Fields(),
|
|
field.String("user_field"),
|
|
)
|
|
}
|