2022-10-26 10:15:14 -04:00
|
|
|
package folderimpl
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
|
|
|
|
|
"github.com/grafana/grafana/pkg/services/folder"
|
|
|
|
|
)
|
|
|
|
|
|
2022-10-28 15:35:49 +02:00
|
|
|
// store is the interface which a folder store must implement.
|
2022-10-26 11:52:01 -04:00
|
|
|
type store interface {
|
|
|
|
|
// Create creates a folder and returns the newly-created folder.
|
2022-11-03 15:21:41 +02:00
|
|
|
Create(ctx context.Context, cmd folder.CreateFolderCommand) (*folder.Folder, error)
|
2022-10-26 10:15:14 -04:00
|
|
|
|
2022-10-26 11:52:01 -04:00
|
|
|
// Delete deletes a folder from the folder store.
|
|
|
|
|
Delete(ctx context.Context, uid string, orgID int64) error
|
2022-10-26 10:15:14 -04:00
|
|
|
|
2022-10-26 11:52:01 -04:00
|
|
|
// Update updates the given folder's UID, Title, and Description.
|
|
|
|
|
// Use Move to change a dashboard's parent ID.
|
2022-11-03 15:21:41 +02:00
|
|
|
Update(ctx context.Context, cmd folder.UpdateFolderCommand) (*folder.Folder, error)
|
2022-10-26 10:15:14 -04:00
|
|
|
|
2022-10-26 11:52:01 -04:00
|
|
|
// Get returns a folder.
|
2022-11-03 15:21:41 +02:00
|
|
|
Get(ctx context.Context, cmd folder.GetFolderQuery) (*folder.Folder, error)
|
2022-10-26 10:15:14 -04:00
|
|
|
|
2022-10-26 11:52:01 -04:00
|
|
|
// GetParents returns an ordered list of parent folder of the given folder.
|
2022-11-03 15:21:41 +02:00
|
|
|
GetParents(ctx context.Context, cmd folder.GetParentsQuery) ([]*folder.Folder, error)
|
2022-10-26 10:15:14 -04:00
|
|
|
|
2022-10-26 11:52:01 -04:00
|
|
|
// GetChildren returns the set of immediate children folders (depth=1) of the
|
|
|
|
|
// given folder.
|
2022-11-03 15:21:41 +02:00
|
|
|
GetChildren(ctx context.Context, cmd folder.GetTreeQuery) ([]*folder.Folder, error)
|
2022-10-26 10:15:14 -04:00
|
|
|
}
|