Skip to content

Commit

Permalink
fix(options): remove the limit varibale
Browse files Browse the repository at this point in the history
never defaulted to zero
  • Loading branch information
danvergara committed Jun 21, 2022
1 parent 36f3a18 commit 348e4b3
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 10 deletions.
3 changes: 0 additions & 3 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ var (
pass string
db string
ssl string
limit int
)

// NewRootCmd returns the root command.
Expand Down Expand Up @@ -49,7 +48,6 @@ func NewRootCmd() *cobra.Command {
Pass: pass,
DBName: db,
SSL: ssl,
Limit: limit,
}

if form.IsEmpty(opts) {
Expand Down Expand Up @@ -108,5 +106,4 @@ func init() {
rootCmd.Flags().StringVarP(&pass, "pass", "", "", "Password for user")
rootCmd.Flags().StringVarP(&db, "db", "", "", "Database name")
rootCmd.Flags().StringVarP(&ssl, "ssl", "", "", "SSL mode")
rootCmd.Flags().IntVarP(&limit, "limit", "", 100, "Size of the result set from the table content query")
}
2 changes: 0 additions & 2 deletions pkg/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
type Client struct {
db *sqlx.DB
driver string
limit int
}

// New return an instance of the client.
Expand All @@ -39,7 +38,6 @@ func New(opts command.Options) (*Client, error) {
c := Client{
db: db,
driver: opts.Driver,
limit: opts.Limit,
}

return &c, nil
Expand Down
1 change: 0 additions & 1 deletion pkg/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ func TestTableContent(t *testing.T) {
Port: port,
DBName: name,
SSL: "disable",
Limit: 100,
}

c, _ := New(opts)
Expand Down
1 change: 0 additions & 1 deletion pkg/command/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ type Options struct {
Pass string
DBName string
SSL string
Limit int
}

// SetDefault returns a Options struct and fills the empty
Expand Down
2 changes: 0 additions & 2 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ type Config struct {
Driver string `validate:"required"`
SSL string `default:"disable"`
}
Limit int `fig:"limit" default:"100"`
User string
Pswd string
Host string
Expand Down Expand Up @@ -76,7 +75,6 @@ func Init() (command.Options, error) {
Pass: cfg.Database.Password,
DBName: cfg.Database.DB,
SSL: cfg.Database.SSL,
Limit: cfg.Limit,
}

return opts, nil
Expand Down
1 change: 0 additions & 1 deletion pkg/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,4 @@ func TestInit(t *testing.T) {
assert.Equal(t, "postgres", opts.User)
assert.Equal(t, "password", opts.Pass)
assert.Equal(t, "postgres", opts.Driver)
assert.Equal(t, 50, opts.Limit)
}

0 comments on commit 348e4b3

Please sign in to comment.