Files
ent/ent.go
Ariel Mashraki 2c8b5a65b7 entc: abandon plugins
Summary:
Go plugin is not a good solution for both internal and external usage.
It's hard to manage and maintain matching versions (both Go and external libraries), and it does not support Windows.

Reviewed By: alexsn

Differential Revision: D16582217

fbshipit-source-id: 81876d2c6f30bbfc16ecf9e5000f0670f2e62484
2019-08-01 05:07:48 -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
IsNullable() 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 }