Documentation ¶
Overview ¶
Package sqlexec provides primitives and functions to work with raw SQL statements and pre-defined SQL Scripts.
Index ¶
- func PathDriver(path string) string
- type FileSystem
- type Generator
- type Param
- type Provider
- func (p *Provider) Dialect() string
- func (p *Provider) Query(name string) (string, error)
- func (p *Provider) ReadDir(storage FileSystem) error
- func (p *Provider) ReadFile(path string, storage FileSystem) error
- func (p *Provider) ReadFrom(r io.Reader) (int64, error)
- func (p *Provider) SetDialect(value string)
- type Rows
- type Runner
- type Scanner
- type Splitter
- type WriteFileSystem
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PathDriver ¶
PathDriver returns the driver name from a given path
Types ¶
type FileSystem ¶
FileSystem provides with primitives to work with the underlying file system
type Generator ¶
type Generator struct { // FileSystem represents the project directory file system. FileSystem WriteFileSystem }
Generator generates a new command.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider loads SQL sqlexecs and provides all SQL statements as commands.
func (*Provider) Query ¶
Query returns a query statement for given name and parameters. The operation can err if the command cannot be found.
func (*Provider) ReadDir ¶
func (p *Provider) ReadDir(storage FileSystem) error
ReadDir loads all sqlexec commands from a given directory. Note that all sqlexecs should have .sql extension.
func (*Provider) ReadFile ¶
func (p *Provider) ReadFile(path string, storage FileSystem) error
ReadFile reads a given file
func (*Provider) SetDialect ¶
SetDialect sets the dialect
type Rows ¶
Rows is a wrapper around sql.Rows which caches costly reflect operations during a looped StructScan.
type Runner ¶
type Runner struct { // FileSystem represents the project directory file system. FileSystem FileSystem // DB is a client to underlying database. DB *sqlx.DB }
Runner runs a SQL statement for given command name and parameters.
type WriteFileSystem ¶
type WriteFileSystem interface { FileSystem // OpenFile opens a new file OpenFile(string, int, fs.FileMode) (fs.File, error) }
WriteFileSystem represents a wriable file system