ent: github.com/facebookincubator/ent/entc Index | Files | Directories

package entc

import "github.com/facebookincubator/ent/entc"

Package entc provides an interface for interacting with entc (ent codegen) as a package rather than an executable.

Index

Package Files

entc.go

func Generate Uses

func Generate(schemaPath string, cfg *gen.Config, options ...Option) error

Generate runs the codegen on the schema path. The default target directory for the assets, is one directory above the schema path. Hence, if the schema package resides in "<project>/ent/schema", the base directory for codegen will be "<project>/ent".

If no storage driver provided by option, SQL driver will be used.

entc.Generate("./ent/path", &gen.Config{
	Header: "// Custom header",
	IDType: &field.TypeInfo{Type: field.TypeInt},
})

func LoadGraph Uses

func LoadGraph(schemaPath string, cfg *gen.Config) (*gen.Graph, error)

LoadGraph loads the schema package from the given schema path, and construct a *gen.Graph.

type Option Uses

type Option func(*gen.Config) error

Option allows for managing codegen configuration using functional options.

func Storage Uses

func Storage(types ...string) Option

Storage sets the list of storage-driver types to support by the codegen.

func TemplateDir Uses

func TemplateDir(path string) Option

TemplateDir parses the template definitions from the files in the directory and associates the resulting templates with codegen templates.

func TemplateFiles Uses

func TemplateFiles(filenames ...string) Option

TemplateFiles parses the named files and associates the resulting templates with codegen templates.

func TemplateGlob Uses

func TemplateGlob(pattern string) Option

TemplateGlob parses the template definitions from the files identified by the pattern and associates the resulting templates with codegen templates.

Directories

PathSynopsis
genPackage gen is the interface for generating loaded schemas into a Go package.
gen/internalPackage internal Code generated by go-bindata.
integration
integration/ent
integration/ent/card
integration/ent/comment
integration/ent/fieldtype
integration/ent/file
integration/ent/filetype
integration/ent/group
integration/ent/groupinfo
integration/ent/item
integration/ent/migrate
integration/ent/node
integration/ent/pet
integration/ent/predicate
integration/ent/schema
integration/ent/user
loadPackage load is the interface for loading schema package into a Go program.
load/internalPackage internal Code generated by go-bindata.

Package entc imports 7 packages (graph). Updated 2019-11-19. Refresh now. Tools for package owners.