dao

package
v0.0.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 5, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TreeLocalDAO

type TreeLocalDAO interface {
	Create(ctx context.Context, local *model.TreeLocalResource) error
	Update(ctx context.Context, local *model.TreeLocalResource) error
	Delete(ctx context.Context, id int) error
	GetByID(ctx context.Context, id int) (*model.TreeLocalResource, error)
	GetList(ctx context.Context, req *model.GetTreeLocalResourceListReq) ([]*model.TreeLocalResource, int64, error)
	GetByIP(ctx context.Context, ip string) (*model.TreeLocalResource, error)
	BindTreeNodes(ctx context.Context, localID int, treeNodeIds []int) error
	UnBindTreeNodes(ctx context.Context, localID int, treeNodeIds []int) error
	BatchGetByIDs(ctx context.Context, ids []int) ([]*model.TreeLocalResource, error)
}

func NewTreeLocalDAO

func NewTreeLocalDAO(db *gorm.DB, logger *zap.Logger) TreeLocalDAO

type TreeNodeDAO

type TreeNodeDAO interface {
	// 基础查询方法
	GetTreeList(ctx context.Context, req *model.GetTreeNodeListReq) ([]*model.TreeNode, int64, error)
	GetNode(ctx context.Context, id int) (*model.TreeNode, error)
	GetChildNodes(ctx context.Context, parentID int) ([]*model.TreeNode, error)
	GetTreeStatistics(ctx context.Context) (*model.TreeNodeStatisticsResp, error)

	// 节点管理方法
	CreateNode(ctx context.Context, node *model.TreeNode) error
	UpdateNode(ctx context.Context, node *model.TreeNode) error
	DeleteNode(ctx context.Context, id int) error

	// 资源管理方法
	BindResource(ctx context.Context, nodeId int, resourceIds []int) error
	UnbindResource(ctx context.Context, nodeId int, resourceId int) error

	// 成员管理方法
	GetNodeMembers(ctx context.Context, nodeId int, memberType string) ([]*model.User, error)
	AddNodeMember(ctx context.Context, nodeId int, userId int, memberType model.TreeNodeMemberType) error
	RemoveNodeMember(ctx context.Context, nodeId int, userId int, memberType model.TreeNodeMemberType) error
}

func NewTreeNodeDAO

func NewTreeNodeDAO(logger *zap.Logger, db *gorm.DB) TreeNodeDAO

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL