Versions in this module Expand all Collapse all v1 v1.1.2 Jun 6, 2023 v1.1.1 Apr 3, 2023 v1.1.0 Nov 10, 2022 Changes in this version + var ErrNodeExists = errors.New("节点已经存在") + var ErrNodeNotExist = errors.New("节点不存在") + var ErrNotLeafNode = errors.New("不是叶子节点") + var ErrParentNotAllowed = errors.New("不满足条件的父节点或者兄弟节点") + var ErrParentNotExist = errors.New("父节点或者兄弟节点不存在") + var ErrUnknownPosition = errors.New("未知位置") + var ErrUnknownStatus = errors.New("未知状态") + type Node struct + CreatedOn *time.Time + Ctx int64 + Depth int + Id int64 + LeftValue int64 + Name string + RightValue int64 + Status Status + UpdatedOn *time.Time + func (this *Node) HasChildNodes() bool + func (this *Node) IsValid() bool + type Position int + const First + const Last + const Left + const Right + const Root + type Repository interface + AddNode func(ctx int64, position Position, rId int64, name string, status Status) (result int64, err error) + AddRoot func(ctx int64, name string, status Status) (result int64, err error) + AddToFirst func(ctx, pId int64, name string, status Status) (result int64, err error) + AddToLast func(ctx, pId int64, name string, status Status) (result int64, err error) + AddToLeft func(ctx, rId int64, name string, status Status) (result int64, err error) + AddToRight func(ctx, rId int64, name string, status Status) (result int64, err error) + BeginTx func() (dbs.TX, Repository) + Dialect func() dbs.Dialect + GetChildNodeIds func(ctx, pId int64, status Status, depth int) (result []int64, err error) + GetChildNodes func(ctx, pId int64, status Status, depth int) (result []*Node, err error) + GetFirstNode func(ctx, pId int64) (result *Node, err error) + GetLastNode func(ctx, pId int64) (result *Node, err error) + GetNextNode func(ctx, id int64) (result *Node, err error) + GetNode func(ctx, id int64) (result *Node, err error) + GetNodeIds func(ctx, pId int64, status Status, depth int, name string, limit, offset int64, ...) (result []int64, err error) + GetNodePaths func(ctx, id int64, status Status) (result []*Node, err error) + GetNodeWithName func(ctx int, name string) (result *Node, err error) + GetNodes func(ctx, pId int64, status Status, depth int, name string, limit, offset int64, ...) (result []*Node, err error) + GetParent func(ctx, id int64) (result *Node, err error) + GetParentNodes func(ctx, id int64, status Status) (result []*Node, err error) + GetPreviousNode func(ctx, id int64) (result *Node, err error) + MoveDown func(ctx, id int64) (err error) + MoveTo func(ctx, id, rId int64, position Position) (err error) + MoveToFirst func(ctx, id, pId int64) (err error) + MoveToLast func(ctx, id, pId int64) (err error) + MoveToLeft func(ctx, id, rId int64) (err error) + MoveToRight func(ctx, id, rId int64) (err error) + MoveToRoot func(ctx, id int64) (err error) + MoveUp func(ctx, id int64) (err error) + RemoveNode func(ctx, id int64) (err error) + UpdateNodeName func(ctx, id int64, name string) (err error) + UpdateNodeStatus func(ctx, id int64, status Status) (err error) + UseIdGenerator func(g dbs.IdGenerator) + WithTx func(tx dbs.TX) Repository + type Status int + const All + const Disable + const Enable