Documentation
¶
Index ¶
- func BuildCobraCommandWithSqletonMiddlewares(cmd cmds.Command, options ...cli.CobraOption) (*cobra.Command, error)
- func BuildSqletonCommandConfigPlan(parsedCommandValues *values.Values) (*glazed_config.Plan, error)
- func GetCobraCommandSqletonMiddlewares(parsedCommandValues *values.Values, cmd *cobra.Command, args []string) ([]sources.Middleware, error)
- func GetSqletonAdditionalMiddlewares(parsedCommandValues *values.Values) ([]sources.Middleware, error)
- func LooksLikeSqletonSQLCommand(contents []byte) bool
- func MarshalSpecToSQLFile(spec *SqlCommandSpec) (string, error)
- func NewRepositoryFactory() handlers.RepositoryFactory
- func NewSqletonParserConfig() cli.CobraParserConfig
- type SourceKind
- type SqlCommand
- func (s *SqlCommand) Description() *cmds.CommandDescription
- func (s *SqlCommand) IsValid() bool
- func (s *SqlCommand) Metadata(ctx context.Context, parsedValues *values.Values) (map[string]interface{}, error)
- func (s *SqlCommand) PrintQuery(ctx context.Context, db *sqlx.DB, dataMap map[string]interface{}) error
- func (s *SqlCommand) RenderQuery(ctx context.Context, db *sqlx.DB, ps map[string]interface{}) (string, error)
- func (s *SqlCommand) RenderQueryFull(ctx context.Context, parsedValues *values.Values) (string, error)
- func (s *SqlCommand) RunIntoGlazeProcessor(ctx context.Context, parsedValues *values.Values, gp middlewares.Processor) error
- func (s *SqlCommand) RunIntoGlazeProcessorWithDB(ctx context.Context, db *sqlx.DB, dataMap map[string]interface{}, ...) error
- func (s *SqlCommand) RunQueryIntoGlaze(ctx context.Context, db *sqlx.DB, gp middlewares.Processor) error
- func (s *SqlCommand) String() string
- func (s *SqlCommand) ToYAML(w io.Writer) error
- type SqlCommandCompiler
- type SqlCommandLoader
- type SqlCommandOption
- type SqlCommandSpec
- type SqletonCommand
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildCobraCommandWithSqletonMiddlewares ¶ added in v0.4.0
func BuildSqletonCommandConfigPlan ¶ added in v0.4.3
func BuildSqletonCommandConfigPlan(parsedCommandValues *values.Values) (*glazed_config.Plan, error)
func GetCobraCommandSqletonMiddlewares ¶ added in v0.4.0
func GetSqletonAdditionalMiddlewares ¶ added in v0.4.3
func GetSqletonAdditionalMiddlewares( parsedCommandValues *values.Values, ) ([]sources.Middleware, error)
func LooksLikeSqletonSQLCommand ¶ added in v0.4.1
func MarshalSpecToSQLFile ¶ added in v0.4.1
func MarshalSpecToSQLFile(spec *SqlCommandSpec) (string, error)
func NewRepositoryFactory ¶
func NewRepositoryFactory() handlers.RepositoryFactory
func NewSqletonParserConfig ¶ added in v0.4.3
func NewSqletonParserConfig() cli.CobraParserConfig
Types ¶
type SourceKind ¶ added in v0.4.1
type SourceKind int
const ( SourceUnknown SourceKind = iota SourceSQLCommand SourceYAMLAlias )
func DetectSourceKind ¶ added in v0.4.1
func DetectSourceKind(path string) SourceKind
type SqlCommand ¶
type SqlCommand struct {
*cmds.CommandDescription `yaml:",inline"`
Query string `yaml:"query"`
SubQueries map[string]string `yaml:"subqueries,omitempty"`
// contains filtered or unexported fields
}
SqlCommand describes a command line command that runs a query
func NewSqlCommand ¶
func NewSqlCommand( description *cmds.CommandDescription, options ...SqlCommandOption, ) (*SqlCommand, error)
func (*SqlCommand) Description ¶
func (s *SqlCommand) Description() *cmds.CommandDescription
func (*SqlCommand) IsValid ¶
func (s *SqlCommand) IsValid() bool
func (*SqlCommand) PrintQuery ¶ added in v0.2.8
func (*SqlCommand) RenderQuery ¶
func (*SqlCommand) RenderQueryFull ¶
func (*SqlCommand) RunIntoGlazeProcessor ¶ added in v0.2.0
func (s *SqlCommand) RunIntoGlazeProcessor( ctx context.Context, parsedValues *values.Values, gp middlewares.Processor, ) error
func (*SqlCommand) RunIntoGlazeProcessorWithDB ¶ added in v0.2.8
func (s *SqlCommand) RunIntoGlazeProcessorWithDB( ctx context.Context, db *sqlx.DB, dataMap map[string]interface{}, gp middlewares.Processor, ) error
func (*SqlCommand) RunQueryIntoGlaze ¶
func (s *SqlCommand) RunQueryIntoGlaze( ctx context.Context, db *sqlx.DB, gp middlewares.Processor) error
RunQueryIntoGlaze runs the query and processes the results into Glaze. This requires RenderQuery to be invoked first in order to have a s.renderedQuery. NOTE(manuel, 2024-04-11) This really could benefit of a further cleanup, what with codegen now
func (*SqlCommand) String ¶
func (s *SqlCommand) String() string
type SqlCommandCompiler ¶ added in v0.4.1
type SqlCommandCompiler struct {
DBConnectionFactory clay_sql.DBConnectionFactory
}
func (*SqlCommandCompiler) Compile ¶ added in v0.4.1
func (c *SqlCommandCompiler) Compile( spec *SqlCommandSpec, options ...cmds.CommandDescriptionOption, ) (*SqlCommand, error)
type SqlCommandLoader ¶
type SqlCommandLoader struct {
DBConnectionFactory sql.DBConnectionFactory
}
func (*SqlCommandLoader) IsFileSupported ¶ added in v0.1.80
func (scl *SqlCommandLoader) IsFileSupported(f fs.FS, fileName string) bool
func (*SqlCommandLoader) LoadCommands ¶ added in v0.1.80
type SqlCommandOption ¶
type SqlCommandOption func(*SqlCommand)
func WithDbConnectionFactory ¶
func WithDbConnectionFactory(factory clay_sql.DBConnectionFactory) SqlCommandOption
func WithQuery ¶
func WithQuery(query string) SqlCommandOption
func WithSubQueries ¶
func WithSubQueries(subQueries map[string]string) SqlCommandOption
type SqlCommandSpec ¶ added in v0.4.1
type SqlCommandSpec struct {
Name string `yaml:"name"`
Short string `yaml:"short"`
Long string `yaml:"long,omitempty"`
Layout []*layout.Section `yaml:"layout,omitempty"`
Flags []*fields.Definition `yaml:"flags,omitempty"`
Arguments []*fields.Definition `yaml:"arguments,omitempty"`
Tags []string `yaml:"tags,omitempty"`
Metadata map[string]interface{} `yaml:"metadata,omitempty"`
Query string `yaml:"query"`
SubQueries map[string]string `yaml:"subqueries,omitempty"`
}
func ParseSQLFileSpec ¶ added in v0.4.1
func ParseSQLFileSpec(path string, contents []byte) (*SqlCommandSpec, error)
func ParseSQLFileSpecFromReader ¶ added in v0.4.1
func ParseSQLFileSpecFromReader(path string, r io.Reader) (*SqlCommandSpec, error)
func (*SqlCommandSpec) Validate ¶ added in v0.4.1
func (s *SqlCommandSpec) Validate() error
type SqletonCommand ¶
Click to show internal directories.
Click to hide internal directories.