ent: github.com/facebookincubator/ent/schema/edge Index | Files

package edge

import "github.com/facebookincubator/ent/schema/edge"


Package Files


func From Uses

func From(name string, t interface{}) *inverseBuilder

From represents a reversed-edge between two vertices that has a back-reference to its source edge.

func To Uses

func To(name string, t interface{}) *assocBuilder

To defines an association edge between two vertices.

type Annotation Uses

type Annotation interface {
    // Name defines the name of the annotation to be retrieved by the codegen.
    Name() string

Annotation is used to attach arbitrary metadata to the edge object in codegen. The object must be serializable to JSON raw value (e.g. struct, map or slice). Template extensions can retrieve this metadata and use it inside their templates.

type Descriptor Uses

type Descriptor struct {
    Tag         string       // struct tag.
    Type        string       // edge type.
    Name        string       // edge name.
    RefName     string       // ref name; inverse only.
    Ref         *Descriptor  // edge reference; to/from of the same type.
    Unique      bool         // unique edge.
    Inverse     bool         // inverse edge.
    Required    bool         // required on creation.
    StorageKey  *StorageKey  // optional storage-key configuration.
    Annotations []Annotation // edge annotations.

A Descriptor for edge configuration.

type StorageKey Uses

type StorageKey struct {
    Table   string   // Table or label.
    Columns []string // Foreign-key columns.

StorageKey holds the configuration for edge storage-key.

type StorageOption Uses

type StorageOption func(*StorageKey)

StorageOption allows for setting the storage configuration using functional options.

func Column Uses

func Column(name string) StorageOption

The Column option sets the foreign-key column name for O2O, O2M and M2O edges. Note that, for M2M edges (2 columns), use the edge.Columns option.

func Columns Uses

func Columns(to, from string) StorageOption

The Columns option sets the foreign-key column names for M2M edges. The 1st column defines the name of the "To" edge, and the 2nd defines the name of the "From" edge (inverse edge). Note that, for O2O, O2M and M2O edges, use the edge.Column option.

func Table Uses

func Table(name string) StorageOption

The Table option sets the table name of M2M edges.

Package edge imports 1 packages (graph) and is imported by 5 packages. Updated 2020-08-10. Refresh now. Tools for package owners.