Files
ent/ent.go
Ariel Mashraki 619b63d5f7 ent/schema: rename nullable to nillable
Reviewed By: idoshveki

Differential Revision: D16687892

fbshipit-source-id: e8cfaaf1241e94c2de0a9fe9077326339d593716
2019-08-07 06:56:33 -07:00

52 lines
1.1 KiB
Go

// Package ent is an interface package for the schemas that use entc.
package ent
import (
"fbc/ent/edge"
"fbc/ent/field"
)
type (
// Schema is the interface for describing an entity schema for entc.
Schema interface {
Type()
Edges() []Edge
Fields() []Field
}
// Field is the interface for vertex and edges fields used by the code generation.
Field interface {
Tag() string
Name() string
Type() field.Type
IsUnique() bool
IsNillable() bool
IsOptional() bool
HasDefault() bool
Value() interface{}
Validators() []interface{}
}
// Edge is the interface for graph edges in the schema. It is used by the code generation.
Edge interface {
Tag() string
Type() string
Name() string
RefName() string
Assoc() *edge.Edge
IsUnique() bool
IsInverse() bool
IsRequired() bool
}
)
// DefaultSchema holds the default schema implementation.
var DefaultSchema = defaultSchema{}
// defaultSchema is the default implementation for the schema.
type defaultSchema struct{ Schema }
func (defaultSchema) Edges() []Edge { return nil }
func (defaultSchema) Fields() []Field { return nil }