add builders and chaining methods for various types and variables for better reusability and readability
This commit is contained in:
@@ -41,3 +41,13 @@ func (s *BeadsService) AllIssues(ctx context.Context) ([]models.Issue, error) {
|
||||
|
||||
return issues, nil
|
||||
}
|
||||
|
||||
func (s *BeadsService) DeleteIssues() error {
|
||||
|
||||
var deleteIssues = "DELETE FROM issues;"
|
||||
|
||||
if _, err := s.UnderlyingDB().Exec(deleteIssues); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
34
internal/service/config.go
Normal file
34
internal/service/config.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package service
|
||||
|
||||
type Config struct {
|
||||
RootCmd string
|
||||
WebAddress string
|
||||
BeadsDBPath string
|
||||
IssuePrefix string
|
||||
StatisticsStoragePath string
|
||||
}
|
||||
|
||||
func (c Config) WithRootCmd(rootCmd string) Config {
|
||||
c.RootCmd = rootCmd
|
||||
return c
|
||||
}
|
||||
|
||||
func (c Config) WithWebAddress(webAddress string) Config {
|
||||
c.WebAddress = webAddress
|
||||
return c
|
||||
}
|
||||
|
||||
func (c Config) WithBeadsDBPath(beadsDBPath string) Config {
|
||||
c.BeadsDBPath = beadsDBPath
|
||||
return c
|
||||
}
|
||||
|
||||
func (c Config) WithIssuePrefix(issuePrefix string) Config {
|
||||
c.IssuePrefix = issuePrefix
|
||||
return c
|
||||
}
|
||||
|
||||
func (c Config) WithStatisticsStoragePath(path string) Config {
|
||||
c.StatisticsStoragePath = path
|
||||
return c
|
||||
}
|
||||
Reference in New Issue
Block a user