Files
ent/ent.go
Ariel Mashraki e0e754717e ent: change ent package name (#1338)
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
2019-08-19 09:32:14 -07:00

71 lines
1.6 KiB
Go

// Package ent is an interface package for the schemas that use entc.
package ent
import (
"github.com/facebookincubator/ent/schema/edge"
"github.com/facebookincubator/ent/schema/field"
)
type (
// The Interface type describes the requirements for an exported type defined in the schema package.
// It functions as the interface between the user's schema types and codegen loader.
// Users should use the Schema type for embedding as follows:
//
// type T struct {
// ent.Schema
// }
//
Interface interface {
Type()
Fields() []Field
Edges() []Edge
Indexes() []Index
}
// 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
}
// Index is the interface for graph indexes in the schema. It is used by the code generation.
Index interface {
IsUnique() bool
Edge() string
Fields() []string
}
// Schema is the default implementation Interface.
Schema struct {
Interface
}
)
// Fields of the schema.
func (Schema) Fields() []Field { return nil }
// Edges of the schema.
func (Schema) Edges() []Edge { return nil }
// Indexes of the schema.
func (Schema) Indexes() []Index { return nil }