Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArgumentParser ¶ added in v1.1.0
type ArgumentParser interface { OptionString(name string, value string) *string PositionalArguments() []string ParseArguments(args []string) error Parse() error }
ArgumentParser parses command line flags.
type DB ¶
type DB interface { Ping() error Query(query string, args ...interface{}) (DBRows, error) Exec(query string, args ...interface{}) (sql.Result, error) }
DB is an adapter interface for database/sql.DB.
type DBAdapter ¶ added in v1.4.1
type DBAdapter struct {
// contains filtered or unexported fields
}
func NewDBAdapter ¶
NewDBAdapter returns an implementation of DB.
func (DBAdapter) Exec ¶ added in v1.4.1
Exec executes a query without returning any rows. The args are for any placeholder parameters in the query.
type DBRows ¶
DBRows is the result of a query. Its cursor starts before the first row of the result set. Use Next to advance from row to row.
type FileSystem ¶
type FileSystem interface { ReadDir(dirname string) ([]os.FileInfo, error) ReadFile(filename string) ([]byte, error) WriteFile(filename string, data []byte, perm fs.FileMode) error }
FileSystem is an interface to read contents from the file system.
type FlagArgumentParser ¶ added in v1.4.1
type FlagArgumentParser struct {
// contains filtered or unexported fields
}
FlagArgumentParser is an implementation of ArgumentParser using the package flag.
func NewArgumentParser ¶ added in v1.1.0
func NewArgumentParser() FlagArgumentParser
func (FlagArgumentParser) OptionString ¶ added in v1.4.1
func (adapter FlagArgumentParser) OptionString(name string, value string) *string
OptionString defines a string flag with specified name, default value, and usage string. The return value is the address of a string variable that stores the value of the flag.
func (FlagArgumentParser) Parse
deprecated
added in
v1.4.1
func (adapter FlagArgumentParser) Parse() error
Deprecated: use ParseArguments instead. Parse is deprecated.
func (FlagArgumentParser) ParseArguments ¶ added in v1.4.1
func (adapter FlagArgumentParser) ParseArguments(args []string) error
ParseArguments parses the command-line flags from os.Args[1:]. Must be called after all flags are defined and before flags are accessed by the program.
func (FlagArgumentParser) PositionalArguments ¶ added in v1.4.1
func (adapter FlagArgumentParser) PositionalArguments() []string
PositionalArguments returns the non-flag command-line arguments.
type IOUtilAdapter ¶
type IOUtilAdapter struct{}
IOUtilAdapter is an implementation of FileSystem using io/ioutil and os.
func (IOUtilAdapter) ReadDir ¶
func (adapter IOUtilAdapter) ReadDir(dirname string) ([]os.FileInfo, error)
ReadDir list the files on a given directory.
type NilPrinterAdapter ¶ added in v1.4.0
type NilPrinterAdapter struct{}