Documentation
¶
Index ¶
- func OpenDatabaseFromViper() (*sqlx.DB, error)
- func RunNamedQueryIntoGlaze(dbContext context.Context, db *sqlx.DB, query string, ...) error
- func RunQueryIntoGlaze(dbContext context.Context, db *sqlx.DB, query string, parameters []interface{}, ...) error
- type DatabaseConfig
- type Source
- type SqlCommand
- func (s *SqlCommand) BuildCobraCommand() (*cobra.Command, error)
- func (s *SqlCommand) Description() *cmds.CommandDescription
- func (sc *SqlCommand) IsValid() bool
- func (s *SqlCommand) RenderQuery(parameters map[string]interface{}) (string, error)
- func (s *SqlCommand) Run(map[string]interface{}) error
- func (s *SqlCommand) RunFromCobra(cmd *cobra.Command, args []string) error
- func (s *SqlCommand) RunQueryIntoGlaze(ctx context.Context, db *sqlx.DB, parameters map[string]interface{}, ...) error
- func (s *SqlCommand) String() string
- type SqlCommandDescription
- type SqlCommandLoader
- type SqletonCommand
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OpenDatabaseFromViper ¶
func RunNamedQueryIntoGlaze ¶
func RunQueryIntoGlaze ¶
Types ¶
type DatabaseConfig ¶
type DatabaseConfig struct {
Host string
Database string
User string
Password string
Port int
Schema string
Type string
DSN string
Driver string
DbtProfilesPath string
DbtProfile string
UseDbtProfiles bool
}
func NewDatabaseConfigFromViper ¶
func NewDatabaseConfigFromViper() *DatabaseConfig
func (*DatabaseConfig) GetSource ¶
func (c *DatabaseConfig) GetSource() (*Source, error)
func (*DatabaseConfig) LogVerbose ¶
func (c *DatabaseConfig) LogVerbose()
LogVerbose just outputs information about the database config to the debug logging level.
func (*DatabaseConfig) ToString ¶
func (c *DatabaseConfig) ToString() string
type Source ¶
type Source struct {
Name string
Type string `yaml:"type"`
Hostname string `yaml:"server"`
Port int `yaml:"port"`
Username string `yaml:"username"`
Password string `yaml:"password"`
Schema string `yaml:"schema"`
Database string `yaml:"database"`
}
Source is the generic structure we use to represent a database connection string
func ParseDbtProfiles ¶
ParseDbtProfiles parses a dbt profiles.yml file and returns a map of sources
func (*Source) ToConnectionString ¶
type SqlCommand ¶
type SqlCommand struct {
Query string
// contains filtered or unexported fields
}
SqlCommand describes a command line command that runs a query
func NewSqlCommand ¶
func NewSqlCommand(description *cmds.CommandDescription, query string) *SqlCommand
func (*SqlCommand) BuildCobraCommand ¶
func (s *SqlCommand) BuildCobraCommand() (*cobra.Command, error)
func (*SqlCommand) Description ¶
func (s *SqlCommand) Description() *cmds.CommandDescription
func (*SqlCommand) IsValid ¶
func (sc *SqlCommand) IsValid() bool
func (*SqlCommand) RenderQuery ¶
func (s *SqlCommand) RenderQuery(parameters map[string]interface{}) (string, error)
func (*SqlCommand) Run ¶
func (s *SqlCommand) Run(map[string]interface{}) error
func (*SqlCommand) RunFromCobra ¶
func (s *SqlCommand) RunFromCobra(cmd *cobra.Command, args []string) error
RunFromCobra actually runs the given SqletonCommand by using the cobra command to parse the necessary flags. It then first pings the database, and then renders the query results into a GlazedProcessor.
func (*SqlCommand) RunQueryIntoGlaze ¶
func (s *SqlCommand) RunQueryIntoGlaze( ctx context.Context, db *sqlx.DB, parameters map[string]interface{}, gp *cli.GlazeProcessor) error
func (*SqlCommand) String ¶
func (s *SqlCommand) String() string
type SqlCommandDescription ¶
type SqlCommandLoader ¶
type SqlCommandLoader struct {
}
func (*SqlCommandLoader) LoadCommandAliasFromYAML ¶
func (scl *SqlCommandLoader) LoadCommandAliasFromYAML(s io.Reader) ([]*cmds.CommandAlias, error)
func (*SqlCommandLoader) LoadCommandFromYAML ¶
type SqletonCommand ¶
Click to show internal directories.
Click to hide internal directories.