ds

package
v0.0.0-...-9fc6fd2 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDirFilesCursor

func GetDirFilesCursor(dirID string, session *r.Session) (*r.Cursor, error)

func GetProjectDirsSortedCursor

func GetProjectDirsSortedCursor(projectID string, session *r.Session) (*r.Cursor, error)

Types

type DirLoader

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

func NewDirLoader

func NewDirLoader(basePath string, session *r.Session) *DirLoader

func (*DirLoader) LoadDirFromDataset

func (d *DirLoader) LoadDirFromDataset(dataset model.DatasetSchema, projectID string) error

type Selection

type Selection struct {
	// IncludeFiles are files that have been explicitly included
	IncludeFiles map[string]bool

	// ExcludeFiles are files that have been explicitly excluded
	ExcludeFiles map[string]bool

	// IncludeFiles are directories that have been explicitly included
	IncludeDirs map[string]bool

	// ExcludeFiles are directories that have been explicitly excluded
	ExcludeDirs map[string]bool

	// Parents is used to track directories that are not in the included and excluded lists.
	// This is used, for example, to track descendant directories under a directory that has
	// been explicitly included or excluded. The application using selection calls AddDir to
	// add directories into this list.
	Parents map[string]bool
}

Selection keeps track of directories and files and whether or not they have been included

func FromFileSelection

func FromFileSelection(s *model.FileSelection) *Selection

FromFileSelection creates a new Selection by taking a FileSelection and inserting its entries into the Selection fields.

func NewSelection

func NewSelection() *Selection

NewSelection creates a new Selection. All map entries have been initialized.

func (*Selection) AddDir

func (s *Selection) AddDir(dirPath string, included bool)

AddDir will add a directory to the Parents field. Callers should add directories to this list when that entry is not already in the selection. Directories are not added if they are in either IncludeDirs or ExcludeDirs. It checks ExcludeDirs when included is false, otherwise it checks IncludeDirs.

func (*Selection) DirExists

func (s *Selection) DirExists(dirPath string) (isIncludedDir bool, exists bool)

DirExists checks if the given dir path exists in the Selection. It returns 2 booleans. The first is true if dir is in IncludeDirs, and false if it is is ExcludeDirs. The second boolean denotes whether or not the dirPath was found. For example:

DirExists("path") => true, true --> in include dirs (first boolean) and found
DirExists("path") => false, true --> in exclude dirs (first boolean) and found
DirExists("path") => false, false --> first value is not meaningful, entry not found

func (*Selection) IsIncludedDir

func (s *Selection) IsIncludedDir(dirPath string) bool

IsIncludedDir checks if a directory is a part of a selection. It first checks the IncludeDirs field, then checks the ExcludeDirs field. If no entry is found in either of these then it checks the Parents field and returns its value if it exists. If after all these checks there is no match then it returns false signifying that the directory is not one that has been selected.

func (*Selection) IsIncludedFile

func (s *Selection) IsIncludedFile(filePath string) bool

IsIncludedFile checks if a file is a part of a selection. It first checks IncludeFiles, then checks ExcludeFiles. If no entry has been found then it returns the files directory by calling IsIncludedDir on the file directory.

Jump to

Keyboard shortcuts

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