File tree Expand file tree Collapse file tree 5 files changed +16
-20
lines changed
cmd/sponge/commands/generate Expand file tree Collapse file tree 5 files changed +16
-20
lines changed Original file line number Diff line number Diff line change @@ -870,7 +870,7 @@ func adaptPgDsn(dsn string) string {
870870
871871 u , err := url .Parse (dsn )
872872 if err != nil {
873- panic ( err )
873+ return dsn
874874 }
875875
876876 if u .RawQuery == "" {
Original file line number Diff line number Diff line change @@ -87,16 +87,16 @@ func HTTPCommand() *cobra.Command {
8787 return err
8888 }
8989 g := & httpGenerator {
90- moduleName : moduleName ,
91- serverName : serverName ,
92- projectName : projectName ,
93- repoAddr : repoAddr ,
94- dbDSN : sqlArgs .DBDsn ,
95- dbDriver : sqlArgs .DBDriver ,
96- codes : codes ,
97- outPath : outPath ,
98- isExtendedAPI : sqlArgs .IsExtendedAPI ,
99-
90+ moduleName : moduleName ,
91+ serverName : serverName ,
92+ projectName : projectName ,
93+ repoAddr : repoAddr ,
94+ dbDSN : sqlArgs .DBDsn ,
95+ dbDriver : sqlArgs .DBDriver ,
96+ codes : codes ,
97+ outPath : outPath ,
98+ isExtendedAPI : sqlArgs .IsExtendedAPI ,
99+ isEmbed : sqlArgs . IsEmbed ,
100100 suitedMonoRepo : suitedMonoRepo ,
101101 }
102102 outPath , err = g .generateCode ()
Original file line number Diff line number Diff line change @@ -96,9 +96,9 @@ func WithEnableLog(log *zap.Logger) Option {
9696 o .enableLog = true
9797 if log != nil {
9898 o .log = log
99- } else {
100- o .log = zap .NewNop ()
99+ return
101100 }
101+ o .log , _ = zap .NewProduction ()
102102 }
103103}
104104
Original file line number Diff line number Diff line change @@ -347,18 +347,14 @@ func defaultOptions() *options {
347347// WithParams set params
348348func WithParams (params map [string ]interface {}) Option {
349349 return func (o * options ) {
350- if o .params != nil {
351- o .params = params
352- }
350+ o .params = params
353351 }
354352}
355353
356354// WithHeaders set headers
357355func WithHeaders (headers map [string ]string ) Option {
358356 return func (o * options ) {
359- if o .headers != nil {
360- o .headers = headers
361- }
357+ o .headers = headers
362358 }
363359}
364360
Original file line number Diff line number Diff line change @@ -130,7 +130,7 @@ func WithFileName(filename string) FileOption {
130130// WithFileMaxSize set maximum file size (MB)
131131func WithFileMaxSize (maxSize int ) FileOption {
132132 return func (f * fileOptions ) {
133- if f . maxSize > 0 {
133+ if maxSize > 0 {
134134 f .maxSize = maxSize
135135 }
136136 }
You can’t perform that action at this time.
0 commit comments