@@ -203,6 +203,45 @@ func (u Update) WithExpressions(newExprs ...sql.Expression) (sql.Node, error) {
203203 return & u , nil
204204}
205205
206+ // UpdateInfo is the Info for OKResults returned by Update nodes.
207+ type UpdateInfo struct {
208+ Matched , Updated , Warnings int
209+ }
210+
211+ // String implements fmt.Stringer
212+ func (ui UpdateInfo ) String () string {
213+ return fmt .Sprintf ("Rows matched: %d Changed: %d Warnings: %d" , ui .Matched , ui .Updated , ui .Warnings )
214+ }
215+
216+ // WithChildren implements the Node interface.
217+ func (u * Update ) WithChildren (children ... sql.Node ) (sql.Node , error ) {
218+ if len (children ) != 1 {
219+ return nil , sql .ErrInvalidChildrenNumber .New (u , len (children ), 1 )
220+ }
221+ np := * u
222+ np .Child = children [0 ]
223+ return & np , nil
224+ }
225+
226+ // CollationCoercibility implements the interface sql.CollationCoercible.
227+ func (* Update ) CollationCoercibility (ctx * sql.Context ) (collation sql.CollationID , coercibility byte ) {
228+ return sql .Collation_binary , 7
229+ }
230+
231+ func (u * Update ) String () string {
232+ pr := sql .NewTreePrinter ()
233+ _ = pr .WriteNode ("Update" )
234+ _ = pr .WriteChildren (u .Child .String ())
235+ return pr .String ()
236+ }
237+
238+ func (u * Update ) DebugString () string {
239+ pr := sql .NewTreePrinter ()
240+ _ = pr .WriteNode ("Update" )
241+ _ = pr .WriteChildren (sql .DebugString (u .Child ))
242+ return pr .String ()
243+ }
244+
206245// WithUpdateJoinTargets returns a new Update node instance with the specified |targets| set as the update join targets
207246// of the update operation
208247func (u * Update ) WithUpdateJoinTargets (targets []sql.Node ) * Update {
@@ -253,42 +292,3 @@ func (u *joinUpdater) Update(ctx *sql.Context, old sql.Row, new sql.Row) error {
253292func (u * joinUpdater ) Close (ctx * sql.Context ) error {
254293 return nil
255294}
256-
257- // UpdateInfo is the Info for OKResults returned by Update nodes.
258- type UpdateInfo struct {
259- Matched , Updated , Warnings int
260- }
261-
262- // String implements fmt.Stringer
263- func (ui UpdateInfo ) String () string {
264- return fmt .Sprintf ("Rows matched: %d Changed: %d Warnings: %d" , ui .Matched , ui .Updated , ui .Warnings )
265- }
266-
267- // WithChildren implements the Node interface.
268- func (u * Update ) WithChildren (children ... sql.Node ) (sql.Node , error ) {
269- if len (children ) != 1 {
270- return nil , sql .ErrInvalidChildrenNumber .New (u , len (children ), 1 )
271- }
272- np := * u
273- np .Child = children [0 ]
274- return & np , nil
275- }
276-
277- // CollationCoercibility implements the interface sql.CollationCoercible.
278- func (* Update ) CollationCoercibility (ctx * sql.Context ) (collation sql.CollationID , coercibility byte ) {
279- return sql .Collation_binary , 7
280- }
281-
282- func (u * Update ) String () string {
283- pr := sql .NewTreePrinter ()
284- _ = pr .WriteNode ("Update" )
285- _ = pr .WriteChildren (u .Child .String ())
286- return pr .String ()
287- }
288-
289- func (u * Update ) DebugString () string {
290- pr := sql .NewTreePrinter ()
291- _ = pr .WriteNode ("Update" )
292- _ = pr .WriteChildren (sql .DebugString (u .Child ))
293- return pr .String ()
294- }
0 commit comments