Skip to content

Commit 5ea8039

Browse files
committed
fix(todo): update todo.sql
1 parent 34c5b28 commit 5ea8039

File tree

3 files changed

+225
-38
lines changed

3 files changed

+225
-38
lines changed

action/node.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ func (n *Node) reqUpdate() error {
246246

247247
func (n *Node) do(ctx context.Context, method string, i int) (ret g.Map, err error) {
248248

249+
// todo 此处运行会导致事务时长与hook时长相关,特别是hook中运行了io类型的操作, 故需要调整到事务外去执行, 且如果事务失败, 则不执行after, 可以改成增加error
249250
for _, hook := range hooks {
250251
if hook.Before != nil {
251252
err := hook.Before(n, method)

demo/todo/app/access.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,12 @@ func AccessCondition(ctx context.Context, req config.AccessConditionReq) (g.Map,
7070
switch req.Table {
7171
case "t_user":
7272
if req.NodeRole == consts.OWNER {
73-
return g.Map{"user_id": user.UserId}, nil
73+
// a=b
74+
// a in []b
75+
// a = (sql)
76+
// a in [sql]
77+
// a not in sql
78+
return g.Map{"user_id": user.UserId, "@sql": []string{"a in ?", "asd"}}, nil
7479
}
7580
case "t_todo":
7681
if req.NodeRole == consts.OWNER {

0 commit comments

Comments
 (0)