-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(root): refactor the root command to call the objects instead…
… manage the application
- Loading branch information
1 parent
cd520e9
commit 18c18bf
Showing
2 changed files
with
31 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package connection | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/danvergara/dblab/pkg/command" | ||
) | ||
|
||
// ValidateOpts make sure the important fields used to open a connection aren't empty. | ||
func ValidateOpts(opts command.Options) error { | ||
if opts.Host == "" && opts.Port == "" && opts.User == "" && opts.Pass == "" && opts.DBName == "" && opts.Driver == "" && opts.URL == "" { | ||
return fmt.Errorf("empty values required to open a session in database") | ||
} | ||
return nil | ||
} |