Documentation
¶
Index ¶
Constants ¶
View Source
const ( // Conn is connection string (-c) basic flag Conn = "conn" // Output is output filename (-o) basic flag Output = "output" // Tables is basic flag (-t) for tables to generate Tables = "tables" // FollowFKs is basic flag (-f) for generate foreign keys models for selected tables FollowFKs = "follow-fk" // Package for model files Pkg = "pkg" )
Variables ¶
This section is empty.
Functions ¶
func CreateCommand ¶
CreateCommand creates cobra command
Types ¶
type Gen ¶
type Gen interface {
AddFlags(command *cobra.Command)
ReadFlags(command *cobra.Command) error
Generate() error
}
Gen is interface for all generators
type Generator ¶
Generator is base generator used in other generators
type Options ¶
type Options struct {
// URL connection string
URL string
// Output file path
Output string
// List of Tables to generate
// Default []string{"public.*"}
Tables []string
// Generate model for foreign keys,
// even if Tables not listed in Tables param
// will not generate fks if schema not listed
FollowFKs bool
// Custom types goes here
CustomTypes model.CustomTypeMapping
// Generate basic ORM queries
GenORM bool
// Struct name for ORM queries. Works only when GenORM == true
DBWrapName string
}
Options is common options for all generators
Click to show internal directories.
Click to hide internal directories.