pkg/package/store/store.go
Method packageStore.deepQueryPackage
has 69 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (ps packageStore) deepQueryPackage(conditions string, values ...string) (pkg *domain.Package, err error) {
rows, err := ps.db.Raw(defaultPackageDeepQueryBase+" "+conditions, values).Rows()
if err != nil {
return nil, err
}
Method packageStore.StorePackage
has 7 return statements (exceeds 4 allowed). Open
Open
func (ps packageStore) StorePackage(pkg *domain.Package) error {
// Check if package exists
err := ps.db.Where("label = ?", pkg.Label).First(pkg).Error
if err == nil {
return ErrPackageExists
Method packageStore.RemovePackage
has 6 return statements (exceeds 4 allowed). Open
Open
func (ps packageStore) RemovePackage(label string) error {
tx := ps.db.Begin()
defer func() {
if r := recover(); r != nil {
tx.Rollback()
Function storeTemplates
has 5 return statements (exceeds 4 allowed). Open
Open
func storeTemplates(tx *gorm.DB, templates []*domain.Template, packageID uint) error {
insertTemplateStmt := "INSERT OR IGNORE INTO templates (created_at, updated_at, is_file, destination, path, description) VALUES (?, ?, ?, ?, ?, ?)"
insertAssociationStmt := "INSERT OR IGNORE INTO package_templates (package_id, template_id) VALUES (?, ?)"
queryIDStmt := "SELECT id from templates WHERE destination = ? AND path = ?"
for _, template := range templates {
Method packageStore.deepQueryPackage
has 5 return statements (exceeds 4 allowed). Open
Open
func (ps packageStore) deepQueryPackage(conditions string, values ...string) (pkg *domain.Package, err error) {
rows, err := ps.db.Raw(defaultPackageDeepQueryBase+" "+conditions, values).Rows()
if err != nil {
return nil, err
}
Function storePlugins
has 5 return statements (exceeds 4 allowed). Open
Open
func storePlugins(tx *gorm.DB, plugins []*domain.Plugin, packageID uint) error {
var err error
insertPluginStmt := "INSERT OR IGNORE INTO plugins (created_at, updated_at, path, exec_number, description) VALUES (?, ?, ?, ?, ?)"
insertAssociationStmt := "INSERT OR IGNORE INTO package_plugins (package_id, plugin_id) VALUES (?, ?)"
queryIDStmt := "SELECT id from plugins WHERE path = ?"