Browse Source

ft: 添加transaction 事务执行

master
SisMaker 4 months ago
parent
commit
16bc72bd63
1 changed files with 7 additions and 6 deletions
  1. +7
    -6
      src/eGLock.erl

+ 7
- 6
src/eGLock.erl View File

@ -278,13 +278,14 @@ transaction(EtsTabKeys, MFAOrFun, TimeOut) ->
try
EtsTabValue = #{OneGetKey => getEtsTabValue(OneEtsTab, OneKey, OneDefValue) || {OneEtsTab, OneKey} = OneGetKey := OneDefValue <- KeysMap},
case transactionApply(MFAOrFun, EtsTabValue) of
{ok, Ret, ChangeEtsTab} ->
[changeEtsTabValue(OneEtsTab, OneKey, ChangeValue) || {OneEtsTab, OneKey} := ChangeValue <- ChangeEtsTab],
{alterTab, AlterTab} ->
[changeEtsTabValue(OneEtsTab, OneKey, ChangeValue) || {OneEtsTab, OneKey} := ChangeValue <- AlterTab],
ok;
{alterTab, Ret, AlterTab} ->
[changeEtsTabValue(OneEtsTab, OneKey, ChangeValue) || {OneEtsTab, OneKey} := ChangeValue <- AlterTab],
Ret;
{ok, Ret} ->
Ret;
{error, Err} ->
Err
OtherRet ->
OtherRet
end
catch
throw:Throw -> Throw;

Loading…
Cancel
Save