folder

package
v0.0.0-...-a62b685 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultOrgID = "c1556e17-b7c0-45a3-a6ae-9546248fb17a"

the default orgID that we will be using for testing

View Source
const MaxChild = 4

maximum possible children per node

View Source
const MaxDepth = 5

max depth of the tree

View Source
const MaxRootSet = 4

how many trees you want to generate

Variables

This section is empty.

Functions

func MarshalJson

func MarshalJson(b interface{}) []byte

MarshalJson marshals data into pretty JSON format.

func PrettyPrint

func PrettyPrint(folders []Folder)

PrettyPrint prints folders in a readable JSON format.

func WriteSampleData

func WriteSampleData(data interface{})

WriteSampleData writes data to sample.json.

Types

type Driver

type Driver struct {
	// contains filtered or unexported fields
}

Driver provides methods to manipulate folders.

func NewDriver

func NewDriver(folders []Folder) *Driver

NewDriver creates a new Driver with the given folders.

func (*Driver) GetAllChildFolders

func (f *Driver) GetAllChildFolders(orgID uuid.UUID, name string) ([]Folder, error)

GetAllChildFolders returns all child folders of a given folder within an organization.

func (*Driver) GetFoldersByOrgID

func (d *Driver) GetFoldersByOrgID(orgID uuid.UUID) []Folder

GetFoldersByOrgID returns all folders for a given organization ID.

func (*Driver) MoveFolder

func (f *Driver) MoveFolder(name string, dst string) ([]Folder, error)

MoveFolder moves a folder from one parent to another within the same organization.

type Folder

type Folder struct {
	Name  string    `json:"name"`
	Path  string    `json:"paths"` // Map "paths" from JSON to "Path" field
	OrgID uuid.UUID `json:"org_id"`
}

Folder represents a folder with a name, path, and organization ID.

func GenerateData

func GenerateData() []Folder

GenerateData generates a random set of folders.

func GetSampleData

func GetSampleData() []Folder

GetSampleData reads folders from sample.json.

Jump to

Keyboard shortcuts

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