Documentation ¶
Index ¶
- func Create(db *gorm.DB, source, parent interface{}) error
- func Delete(db *gorm.DB, source interface{}) error
- func MoveTo(db *gorm.DB, node, to interface{}, direction MoveDirection) error
- func Rebuild(db *gorm.DB, source interface{}, doUpdate bool) (affectedCount int, err error)
- type MoveDirection
- type Tree
- type TreeNode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Create ¶
Create a new node within its parent by Gorm original Create() method ```nestedset.Create(db, &Category{...}, nil)``` will create a new category in root level ```nestedset.Create(db, &Category{...}, &parent)``` will create a new category under parent node as its last child
func Delete ¶
Delete a node from scoped list and its all descendent ```nestedset.Delete(db, &Category{...})```
Types ¶
type MoveDirection ¶
type MoveDirection int
MoveDirection means where the node is going to be located
const ( // MoveDirectionLeft : MoveTo(db, a, n, MoveDirectionLeft) => a|n|... MoveDirectionLeft MoveDirection = -1 // MoveDirectionRight : MoveTo(db, a, n, MoveDirectionRight) => ...|n|a| MoveDirectionRight MoveDirection = 1 // MoveDirectionInner : MoveTo(db, a, n, MoveDirectionInner) => [n [...|a]] MoveDirectionInner MoveDirection = 0 )
MoveDirections ...
Click to show internal directories.
Click to hide internal directories.