Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(schemaPath string, cfg *gen.Config, options ...Option) (err 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

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

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

Types

type Option

type Option func(*gen.Config) error

Option allows for managing codegen configuration using functional options.

func FeatureNames

func FeatureNames(names ...string) Option

FeatureNames enables sets of features by their names.

func Storage

func Storage(typ string) Option

Storage sets the storage-driver type to support by the codegen.

func TemplateDir

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

func TemplateFiles(filenames ...string) Option

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

func TemplateGlob

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.

Source Files

Directories

Path Synopsis
gen Package gen is the interface for generating loaded schemas into a Go package.
gen/internal Package internal Code generated by go-bindata.
integration/config/ent
integration/config/ent/enttest
integration/config/ent/hook
integration/config/ent/migrate
integration/config/ent/predicate
integration/config/ent/runtime
integration/config/ent/schema
integration/config/ent/user
integration/customid/ent
integration/customid/ent/blob
integration/customid/ent/car
integration/customid/ent/enttest
integration/customid/ent/group
integration/customid/ent/hook
integration/customid/ent/migrate
integration/customid/ent/pet
integration/customid/ent/predicate
integration/customid/ent/runtime
integration/customid/ent/schema
integration/customid/ent/user
integration/ent
integration/ent/card
integration/ent/comment
integration/ent/enttest
integration/ent/fieldtype
integration/ent/file
integration/ent/filetype
integration/ent/goods
integration/ent/group
integration/ent/groupinfo
integration/ent/hook
integration/ent/item
integration/ent/migrate
integration/ent/node
integration/ent/pet
integration/ent/predicate
integration/ent/role
integration/ent/runtime
integration/ent/schema
integration/ent/spec
integration/ent/task
integration/ent/template
integration/ent/user
integration/gremlin/ent
integration/gremlin/ent/card
integration/gremlin/ent/comment
integration/gremlin/ent/enttest
integration/gremlin/ent/fieldtype
integration/gremlin/ent/file
integration/gremlin/ent/filetype
integration/gremlin/ent/goods
integration/gremlin/ent/group
integration/gremlin/ent/groupinfo
integration/gremlin/ent/hook
integration/gremlin/ent/item
integration/gremlin/ent/node
integration/gremlin/ent/pet
integration/gremlin/ent/predicate
integration/gremlin/ent/runtime
integration/gremlin/ent/spec
integration/gremlin/ent/task
integration/gremlin/ent/user
integration/hooks/ent
integration/hooks/ent/card
integration/hooks/ent/enttest
integration/hooks/ent/hook
integration/hooks/ent/migrate
integration/hooks/ent/predicate
integration/hooks/ent/runtime
integration/hooks/ent/schema
integration/hooks/ent/user
integration/idtype/ent
integration/idtype/ent/enttest
integration/idtype/ent/hook
integration/idtype/ent/migrate
integration/idtype/ent/predicate
integration/idtype/ent/runtime
integration/idtype/ent/schema
integration/idtype/ent/user
integration/json/ent
integration/json/ent/enttest
integration/json/ent/hook
integration/json/ent/migrate
integration/json/ent/predicate
integration/json/ent/runtime
integration/json/ent/schema
integration/json/ent/user
integration/migrate/entv1
integration/migrate/entv1/car
integration/migrate/entv1/enttest
integration/migrate/entv1/hook
integration/migrate/entv1/migrate
integration/migrate/entv1/predicate
integration/migrate/entv1/runtime
integration/migrate/entv1/schema
integration/migrate/entv1/user
integration/migrate/entv2
integration/migrate/entv2/car
integration/migrate/entv2/enttest
integration/migrate/entv2/group
integration/migrate/entv2/hook
integration/migrate/entv2/media
integration/migrate/entv2/migrate
integration/migrate/entv2/pet
integration/migrate/entv2/predicate
integration/migrate/entv2/runtime
integration/migrate/entv2/schema
integration/migrate/entv2/user
integration/privacy/ent
integration/privacy/ent/enttest
integration/privacy/ent/hook
integration/privacy/ent/migrate
integration/privacy/ent/predicate
integration/privacy/ent/privacy
integration/privacy/ent/runtime
integration/privacy/ent/schema
integration/privacy/ent/task
integration/privacy/ent/team
integration/privacy/ent/user
integration/privacy/rule
integration/privacy/viewer
integration/template/ent
integration/template/ent/enttest
integration/template/ent/group
integration/template/ent/hook
integration/template/ent/migrate
integration/template/ent/pet
integration/template/ent/predicate
integration/template/ent/runtime
integration/template/ent/schema
integration/template/ent/user
internal
load Package load is the interface for loading schema package into a Go program.
load/internal Package internal Code generated by go-bindata.