Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( VarStringDSN string VarStringOutputDir string VarStringTables string VarBoolAutoMixin bool )
Functions ¶
func FormatFile ¶
func FormatFile(ctx *GenContext) error
FormatFile formats the file to adjust simple admin
func WriteSchema ¶
func WriteSchema(mutations []schemast.Mutator, opts ...ImportOption) error
WriteSchema receives a list of mutators, and writes an ent schema to a given location in the file system.
Types ¶
type GenContext ¶
type ImportOption ¶
type ImportOption func(*ImportOptions)
ImportOption allows for managing import configuration using functional options.
func WithDriver ¶
func WithDriver(drv *mux.ImportDriver) ImportOption
WithDriver provides an import driver to be used by SchemaImporter.
func WithExcludedTables ¶
func WithExcludedTables(tables []string) ImportOption
WithExcludedTables supplies the set of tables to exclude.
func WithSchemaPath ¶
func WithSchemaPath(path string) ImportOption
WithSchemaPath provides a DSN (data source name) for reading the schema & tables from.
func WithTables ¶
func WithTables(tables []string) ImportOption
WithTables limits the schema import to a set of given tables (by all tables are imported)
type ImportOptions ¶
type ImportOptions struct {
// contains filtered or unexported fields
}
ImportOptions are the options passed on to every SchemaImporter.
type MySQL ¶
type MySQL struct {
*ImportOptions
}
MySQL holds the schema import options and an Atlas inspector instance
func NewMySQL ¶
func NewMySQL(i *ImportOptions) (*MySQL, error)
NewMySQL - create aמ import structure for MySQL.
type Postgres ¶
type Postgres struct {
*ImportOptions
}
Postgres implements SchemaImporter for PostgreSQL databases.
type SchemaImporter ¶
type SchemaImporter interface { // SchemaMutations imports a given schema from a data source and returns a list of schemast mutators. SchemaMutations(context.Context) ([]schemast.Mutator, error) }
SchemaImporter is the interface that wraps the SchemaMutations method.
func NewImport ¶
func NewImport(opts ...ImportOption) (SchemaImporter, error)
NewImport calls the relevant data source importer based on a given dialect.
func NewPostgreSQL ¶
func NewPostgreSQL(i *ImportOptions) (SchemaImporter, error)
NewPostgreSQL - returns a new *Postgres.