diff --git a/preprocessor/folder/database.go b/preprocessor/folder/database.go index 4f42bf2..eec0b96 100644 --- a/preprocessor/folder/database.go +++ b/preprocessor/folder/database.go @@ -45,6 +45,7 @@ func initDbTableIfNotExists(connPool *pgxpool.Pool) error { return nil } +// ProjectQueryResult represents the result of a project metadata query type ProjectQueryResult struct { ProjectId *string ProjectPath *string @@ -53,6 +54,7 @@ type ProjectQueryResult struct { AuthorIdentifier *string } +// queryAllProjects queries all project metadata from the database func queryAllProjects(connPool *pgxpool.Pool) ([]ProjectQueryResult, error) { var result []ProjectQueryResult rows, err := connPool.Query( diff --git a/preprocessor/folder/database_schema.go b/preprocessor/folder/database_schema.go index 29fdd9d..53a7a74 100644 --- a/preprocessor/folder/database_schema.go +++ b/preprocessor/folder/database_schema.go @@ -16,6 +16,7 @@ var FILE_STATUS_TABLE = `CREATE TABLE IF NOT EXISTS file_status ( CREATE INDEX IF NOT EXISTS idx_file_status_status ON file_status (status); ` +// schema for project_metadata table var PROJECT_METADATA_TABLE = `CREATE TABLE IF NOT EXISTS project_metadata ( id BIGSERIAL PRIMARY KEY, project_id TEXT UNIQUE NOT NULL, diff --git a/preprocessor/folder/folder.go b/preprocessor/folder/folder.go index 63eb9e4..7787c27 100644 --- a/preprocessor/folder/folder.go +++ b/preprocessor/folder/folder.go @@ -36,6 +36,7 @@ func scanSyncDirectory(subPath string) (fileList []string, dirList []string, err return fileList, dirList, err } +// watchLoop watches for file changes in a directory and checks if it should be handled func watchLoop(w *fsnotify.Watcher, pgPool *pgxpool.Pool, dirPathToProject map[string]ProjectQueryResult) { for { select {