github.com/segakazzz/buffalo@v0.16.22-0.20210119082501-1f52048d3feb/genny/mail/options.go (about) 1 package mail 2 3 import ( 4 "fmt" 5 6 "github.com/gobuffalo/flect/name" 7 "github.com/gobuffalo/meta" 8 ) 9 10 // Options needed to create a new mailer 11 type Options struct { 12 App meta.App `json:"app"` 13 Name name.Ident `json:"name"` 14 SkipInit bool `json:"skip_init"` 15 } 16 17 // Validate options are useful 18 func (opts *Options) Validate() error { 19 if opts.App.IsZero() { 20 opts.App = meta.New(".") 21 } 22 23 if len(opts.Name.String()) == 0 { 24 return fmt.Errorf("you must supply a name for your mailer") 25 } 26 return nil 27 }