go-pass-gen/passgen/options.go
2021-10-20 17:40:11 +02:00

17 lines
374 B
Go

package passgen
// Options configures the PasswordGenerator.
type Options struct {
// Length of the new password
Length int
// WithNumbers is set to true if the password must contain numbers.
WithNumbers bool
}
// SetDefaults ensure options are usable to avoid certain bugs.
func (o *Options) SetDefaults() *Options {
if o.Length == 0 {
o.Length = 6
}
return o
}