Documentation
¶
Overview ¶
ackage cmd provides dbtpl command-line application logic.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Args ¶
type Args struct {
// TemplateTypes are the allowed template types.
TemplateTypes []string
// Verbose enables verbose output.
Verbose bool
// LoaderParams are database loader parameters.
LoaderParams LoaderParams
// TemplateParams are template parameters.
TemplateParams TemplateParams
// QueryParams are query parameters.
QueryParams QueryParams
// SchemaParams are schema parameters.
SchemaParams SchemaParams
// OutParams are out parameters.
OutParams OutParams
}
Args contains command-line arguments.
type LoaderParams ¶
type LoaderParams struct {
// Schema is the name of the database schema.
Schema string
}
LoaderParams are loader parameters.
type OutParams ¶
type OutParams struct {
// Out is the out path.
Out string
// Append toggles appending to existing file.
Append bool
// Single when true changes behavior so that output is to one file.
Single string
// Debug toggles direct writing of files to disk, skipping post processing.
Debug bool
}
OutParams are out parameters.
type QueryParams ¶
type QueryParams struct {
// Query is the query to introspect.
Query string
// Type is the type name.
Type string
// TypeComment is the type comment.
TypeComment string
// Func is the func name.
Func string
// FuncComment is the func comment.
FuncComment string
// Trim enables triming whitespace.
Trim bool
// Strip enables stripping the '::<type> AS <name>' in queries.
Strip bool
// One toggles the generated code to expect only one result.
One bool
// Flat toggles the generated code to return all scanned values directly.
Flat bool
// Exec toggles the generated code to do a db exec.
Exec bool
// Interpolate enables interpolation.
Interpolate bool
// Delimiter is the delimiter for parameterized values.
Delimiter string
// Fields are the fields to scan the result to.
Fields string
// AllowNulls enables results to have null types.
AllowNulls bool
}
QueryParams are query parameters.
type SchemaParams ¶
type SchemaParams struct {
// FkMode is the foreign resolution mode.
FkMode string
// Include allows the user to specify which types should be included. Can
// match multiple types via regex patterns.
//
// - When unspecified, all types are included.
// - When specified, only types match will be included.
// - When a type matches an exclude entry and an include entry,
// the exclude entry will take precedence.
Include []*glob.Glob
// Exclude allows the user to specify which types should be skipped. Can
// match multiple types via regex patterns.
//
// When unspecified, all types are included in the schema.
Exclude []*glob.Glob
// UseIndexNames toggles using index names.
//
// This is not enabled by default, because index names are often generated
// using database design software which often gives non-descriptive names
// to indexes (for example, 'authors__b124214__u_idx' instead of the more
// descriptive 'authors_title_idx').
UseIndexNames bool
}
SchemaParams are schema parameters.
type TemplateParams ¶
type TemplateParams struct {
// Type is the name of the template.
Type string
// TypeChanged is the changed flag for type.
TypeChanged bool
// Src is the src directory of the template.
Src string
// SrcChanged is the changed flag for src.
SrcChanged bool
}
TemplateParams are template parameters.
Click to show internal directories.
Click to hide internal directories.