-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build Delete() for delete a node and all its descendant #12
Conversation
nested_set.go
Outdated
if err != nil { | ||
return nil | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ugly Gorm lock pattern. do you know how to lock a row without Find()?
nested_set.go
Outdated
@@ -140,6 +147,7 @@ func Create(db *gorm.DB, source, parent interface{}) error { | |||
return err | |||
} | |||
|
|||
tx, _, _ := parseNode(db, source) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tx should be refreshed after UPDATE.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@huacnlee @griffinqiu
any idea why?
Really confused me a lot.
nested_set.go
Outdated
@@ -197,7 +252,7 @@ func MoveTo(db *gorm.DB, node, to interface{}, direction MoveDirection) error { | |||
return err | |||
} | |||
|
|||
tx = db.Table(targetNode.TableName) | |||
tx = tx.Table(targetNode.TableName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no db should be used after tx took after its scope
No description provided.