Documentation
¶
Index ¶
- func LoadSqletonCommandFromYAML(s io.Reader, factory DBConnectionFactory, ...) (cmds.Command, error)
- func NewSqlHelpersParameterLayer() (*layers.ParameterLayerImpl, error)
- func OpenDatabaseFromSqletonConnectionLayer(parsedLayers map[string]*layers.ParsedParameterLayer) (*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 ConnectionParameterLayer
- type DBConnectionFactory
- type DatabaseConfig
- type DbtParameterLayer
- type Source
- type SqlCommand
- func (s *SqlCommand) Description() *cmds.CommandDescription
- func (s *SqlCommand) IsValid() bool
- func (s *SqlCommand) RenderQuery(ps map[string]interface{}) (string, error)
- func (s *SqlCommand) Run(ctx context.Context, parsedLayers map[string]*layers.ParsedParameterLayer, ...) error
- func (s *SqlCommand) RunQueryIntoGlaze(ctx context.Context, db *sqlx.DB, ps map[string]interface{}, gp cmds.Processor) error
- func (s *SqlCommand) String() string
- type SqlCommandDescription
- type SqlCommandLoader
- type SqletonCommand
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadSqletonCommandFromYAML ¶ added in v0.1.15
func LoadSqletonCommandFromYAML( s io.Reader, factory DBConnectionFactory, options ...cmds.CommandDescriptionOption) (cmds.Command, error)
func NewSqlHelpersParameterLayer ¶ added in v0.1.5
func NewSqlHelpersParameterLayer() (*layers.ParameterLayerImpl, error)
func OpenDatabaseFromSqletonConnectionLayer ¶ added in v0.1.8
func RunNamedQueryIntoGlaze ¶
Types ¶
type ConnectionParameterLayer ¶ added in v0.1.5
type ConnectionParameterLayer struct {
layers.ParameterLayerImpl
}
func NewSqlConnectionParameterLayer ¶ added in v0.1.5
func NewSqlConnectionParameterLayer( options ...layers.ParameterLayerOptions, ) (*ConnectionParameterLayer, error)
func (*ConnectionParameterLayer) ParseFlagsFromCobraCommand ¶ added in v0.1.5
func (cp *ConnectionParameterLayer) ParseFlagsFromCobraCommand(cmd *cobra.Command) (map[string]interface{}, error)
type DBConnectionFactory ¶ added in v0.1.5
type DatabaseConfig ¶
type DatabaseConfig struct {
Host string `glazed.parameter:"host"`
Database string `glazed.parameter:"database"`
User string `glazed.parameter:"user"`
Password string `glazed.parameter:"password"`
Port int `glazed.parameter:"port"`
Schema string `glazed.parameter:"schema"`
Type string `glazed.parameter:"db-type"`
DSN string `glazed.parameter:"dsn"`
Driver string `glazed.parameter:"driver"`
DbtProfilesPath string `glazed.parameter:"dbt-profiles-path"`
DbtProfile string `glazed.parameter:"dbt-profile"`
UseDbtProfiles bool `glazed.parameter:"use-dbt-profiles"`
}
func NewConfigFromParsedLayers ¶ added in v0.1.8
func NewConfigFromParsedLayers(parsedLayers map[string]*layers.ParsedParameterLayer) (*DatabaseConfig, error)
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 DbtParameterLayer ¶ added in v0.1.5
type DbtParameterLayer struct {
layers.ParameterLayerImpl
}
func NewDbtParameterLayer ¶ added in v0.1.5
func NewDbtParameterLayer() (*DbtParameterLayer, error)
func (*DbtParameterLayer) ParseFlagsFromCobraCommand ¶ added in v0.1.5
func (d *DbtParameterLayer) ParseFlagsFromCobraCommand(cmd *cobra.Command) (map[string]interface{}, error)
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, factory DBConnectionFactory, query string, ) (*SqlCommand, error)
func (*SqlCommand) Description ¶
func (s *SqlCommand) Description() *cmds.CommandDescription
func (*SqlCommand) IsValid ¶
func (s *SqlCommand) IsValid() bool
func (*SqlCommand) RenderQuery ¶
func (s *SqlCommand) RenderQuery(ps map[string]interface{}) (string, error)
func (*SqlCommand) Run ¶
func (s *SqlCommand) Run( ctx context.Context, parsedLayers map[string]*layers.ParsedParameterLayer, ps map[string]interface{}, gp cmds.Processor, ) error
func (*SqlCommand) RunQueryIntoGlaze ¶
func (*SqlCommand) String ¶
func (s *SqlCommand) String() string
type SqlCommandDescription ¶
type SqlCommandDescription struct {
Name string `yaml:"name"`
Short string `yaml:"short"`
Long string `yaml:"long,omitempty"`
Flags []*parameters.ParameterDefinition `yaml:"flags,omitempty"`
Arguments []*parameters.ParameterDefinition `yaml:"arguments,omitempty"`
Layers []layers.ParameterLayer `yaml:"layers,omitempty"`
Query string `yaml:"query"`
}
type SqlCommandLoader ¶
type SqlCommandLoader struct {
DBConnectionFactory DBConnectionFactory
}
func (*SqlCommandLoader) LoadCommandAliasFromYAML ¶
func (scl *SqlCommandLoader) LoadCommandAliasFromYAML(s io.Reader) ([]*cmds.CommandAlias, error)
func (*SqlCommandLoader) LoadCommandFromYAML ¶
func (scl *SqlCommandLoader) LoadCommandFromYAML( s io.Reader, options ...cmds.CommandDescriptionOption, ) ([]cmds.Command, error)
Click to show internal directories.
Click to hide internal directories.