Lunny Xiao
34283a74e8
Allow detect whether it's in a database transaction for a context.Context ( #21756 )
...
Fix #19513
This PR introduce a new db method `InTransaction(context.Context)`,
and also builtin check on `db.TxContext` and `db.WithTx`.
There is also a new method `db.AutoTx` has been introduced but could be used by other PRs.
`WithTx` will always open a new transaction, if a transaction exist in context, return an error.
`AutoTx` will try to open a new transaction if no transaction exist in context.
That means it will always enter a transaction if there is no error.
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: 6543 <6543@obermui.de>
2022-11-12 21:18:50 +01:00
..
2022-11-10 14:43:53 +08:00
2022-05-06 10:12:30 +01:00
2022-05-02 23:22:45 +08:00
2022-10-24 20:29:17 +01:00
2022-10-12 13:18:26 +08:00
2022-11-10 14:43:53 +08:00
2022-09-05 14:04:18 +08:00
2022-10-12 13:18:26 +08:00
2022-10-24 22:23:25 +03:00
2022-11-03 20:23:20 +02:00
2022-08-30 21:15:45 -05:00
2022-10-31 23:51:14 +08:00
2022-08-30 21:15:45 -05:00
2022-08-25 10:31:57 +08:00
2022-01-26 12:10:10 +08:00
2022-10-29 15:04:21 +08:00
2022-10-23 22:44:45 +08:00
2022-10-24 20:29:17 +01:00
2020-10-02 23:37:53 -04:00
2022-09-26 13:50:03 +08:00
2022-10-24 20:29:17 +01:00
2022-11-08 23:13:58 +08:00
2022-07-23 14:38:03 +08:00
2022-01-19 19:31:39 -05:00
2022-10-24 20:29:17 +01:00
2022-10-31 17:10:33 +02:00
2022-04-01 16:47:50 +08:00
2022-07-28 11:04:36 +08:00
2022-10-24 20:29:17 +01:00
2022-11-09 02:11:26 +02:00
2022-10-24 20:29:17 +01:00
2022-08-25 10:31:57 +08:00
2022-09-04 13:47:56 +03:00
2022-07-08 20:45:12 +01:00
2022-08-29 16:38:49 +02:00
2022-11-03 23:49:00 +08:00
2022-10-24 20:29:17 +01:00
2022-10-24 20:29:17 +01:00
2022-10-18 12:52:25 -04:00
2021-06-07 07:27:09 +02:00
2022-08-30 21:15:45 -05:00
2022-10-24 20:29:17 +01:00
2022-06-20 12:02:49 +02:00
2021-08-19 16:41:20 -04:00
2022-08-21 19:20:43 +01:00
2022-10-12 13:18:26 +08:00
2022-10-24 20:29:17 +01:00
2022-10-24 20:29:17 +01:00
2022-10-18 12:52:25 -04:00
2022-06-10 13:39:53 +08:00
2022-11-12 21:18:50 +01:00
2022-02-04 18:03:15 +01:00
2022-01-20 18:46:10 +01:00
2022-11-11 14:39:27 +08:00
2022-06-25 19:06:01 +02:00
2022-08-21 19:20:43 +01:00
2022-09-24 21:04:14 +08:00
2022-11-04 17:04:08 +08:00
2022-11-08 23:13:58 +08:00
2022-10-12 13:18:26 +08:00
2022-11-10 14:43:53 +08:00
2022-11-10 14:43:53 +08:00
2022-08-16 10:22:25 +08:00
2022-10-26 21:34:44 +08:00
2022-10-18 07:50:37 +02:00
2022-07-29 17:26:55 +02:00
2022-10-17 07:29:26 +08:00
2021-12-20 04:41:31 +00:00
2021-12-23 16:27:33 +00:00
2020-04-05 07:20:50 +01:00
2022-10-18 07:50:37 +02:00
2022-11-04 17:04:08 +08:00
2022-08-28 10:43:25 +01:00
2022-11-04 17:04:08 +08:00