Documentation
¶
Overview ¶
Package di is a package that implements Dependency Injection through methods that create the options needed for structs to be created.
Index ¶
- type DI
- func (s *DI) CallMakePlumbRepo() callbacks.MakePlumb
- func (s *DI) CallMakePlumbTemplate() callbacks.MakePlumb
- func (s *DI) ConfigFile() *config.File
- func (s *DI) LogLevel(lvl logger.Level)
- func (s *DI) MakeCheck() *check.Check
- func (s *DI) MakeCheckVars() *checkvars.Check
- func (s *DI) MakeClient() *client.Client
- func (s *DI) MakeEnvs() *env.Vars
- func (s *DI) MakeErrorHandler() *errs.Handler
- func (s *DI) MakeExitHandler() *exit.Handler
- func (s *DI) MakeInit() *initialize.Init
- func (s *DI) MakeInstall() *install.Install
- func (s *DI) MakeList() *list.List
- func (s *DI) MakeLogFile(logfile string) *os.File
- func (s *DI) MakeLoggerOutput(prefix string) *logger.Router
- func (s *DI) MakeORM() *gorm.DB
- func (s *DI) MakeRemove() *remove.Remove
- func (s *DI) MakeRepo() *repo.Repo
- func (s *DI) MakeSearch() *search.Search
- func (s *DI) MakeSetup() *setup.Setup
- func (s *DI) MakeStart() *start.Start
- func (s *DI) MakeSync() *sync.Sync
- func (s *DI) MakeTableWriter() *tablewriter.Table
- func (s *DI) MakeTemplate() *template.Template
- func (s *DI) MakeUpdate() *update.Update
- func (s *DI) MakeVCS() *vcs.VCS
- func (s *DI) MakeValidate() *validator.Validate
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DI ¶
type DI struct {
Home string
ExitMode int // Exit mode either exit.None or exit.Panic. See package exit for context
// No Colour output when running commands.
NoColour bool
// Project name, normally supplied by the start sub command.
ProjectName string
PathMetadataDir string
PathTemplateConf string
PathRepoDir string
PathTemplateDir string
PathUserConf string
SqliteDB string
ModelDB string
Stdin io.Reader
Stderr io.Writer
Stdout io.Writer
// contains filtered or unexported fields
}
DI provides Dependency Injection Container for resources & services.
func New ¶
New get di using the supplied "home" directory option. Any Dependency Injection (DI) configuration created by di is then contextualized by the home variable. For instance when home is set the paths...
{{home}}/.kick/config.yml
{{home}}/.kick/templates.yml
{{home}}/.kick/metadata/metadata.db
{{home}}/.kick/templates
etc..
are then factored in when creating dependency injections.
If initialization is needed for testing then the initialize package can be used. For example
set := New(&Options{home: "/tmp/tmp_home"});
init := set.MakeInitialize()
init.Init()
will create the structures under "/tmp/tmp_home"
"home" must be explicitly set or a panic will ensue.
func (*DI) CallMakePlumbRepo ¶
CallMakePlumbRepo dependency injector
func (*DI) CallMakePlumbTemplate ¶
CallMakePlumbTemplate dependency injector
func (*DI) ConfigFile ¶
ConfigFile load di from configuration file
func (*DI) MakeCheckVars ¶
MakeCheckVars inject prompt struct
func (*DI) MakeErrorHandler ¶
MakeErrorHandler dependency injector
func (*DI) MakeExitHandler ¶
MakeExitHandler dependency injector
func (*DI) MakeInstall ¶
MakeInstall dependency injector
func (*DI) MakeLogFile ¶
MakeLogFile create a logfile and return the interface
func (*DI) MakeLoggerOutput ¶
MakeLoggerOutput inject logger.OutputIface.
func (*DI) MakeTableWriter ¶
func (s *DI) MakeTableWriter() *tablewriter.Table
MakeTabwritter dependency injector
func (*DI) MakeTemplate ¶
MakeTemplate dependency injector
func (*DI) MakeValidate ¶
MakeValidate dependency injector