File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -252,14 +252,20 @@ func writeCreateQuery(w io.Writer, args *scaffoldCommandArgs) {
252252
253253//goland:noinspection GoUnhandledErrorResult
254254func writeDeleteQuery (w io.Writer , args * scaffoldCommandArgs ) {
255- fmt .Fprintf (w , "-- name: Delete%s\n " , args .SingularEntity )
255+ fmt .Fprintf (w , "-- name: Delete%s :exec \n " , args .SingularEntity )
256256 fmt .Fprintf (w , "DELETE FROM %s\n " , args .Table )
257257 fmt .Fprintf (w , "WHERE %s = ?;" , args .IDColumn .Name )
258258}
259259
260260//goland:noinspection GoUnhandledErrorResult
261261func writeUpdateQuery (w io.Writer , args * scaffoldCommandArgs ) {
262- fmt .Fprintf (w , "-- name: Update%s\n " , args .SingularEntity )
262+ var mode string
263+ if args .NoReturningClause {
264+ mode = ":exec"
265+ } else {
266+ mode = ":one"
267+ }
268+ fmt .Fprintf (w , "-- name: Update%s %s\n " , args .SingularEntity , mode )
263269 fmt .Fprintf (w , "UPDATE %s\n " , args .Table )
264270 fmt .Fprintf (w , "SET\n " )
265271 for i , col := range args .NonIDColumns {
You can’t perform that action at this time.
0 commit comments