Combine functions

This commit is contained in:
Brian Buller 2023-08-23 11:55:45 -05:00
parent dcfd80d082
commit 9ef6c61051

View File

@ -55,6 +55,12 @@ func (projectlist *ProjectList) AddProject(project *Project) {
projectlist.Projects[0] = project projectlist.Projects[0] = project
} }
// AddProjects adds all passed projects to the list
func (projectlist *ProjectList) AddProjects(projects []*Project) {
projectlist.Projects = append(projectlist.Projects, projects...)
}
func (projectlist *ProjectList) Combine(other *ProjectList) { projectlist.AddProjects(other.Projects) }
// GetProject returns the Project with the given project 'id' form the ProjectList. // GetProject returns the Project with the given project 'id' form the ProjectList.
// Returns an error if Project could not be found. // Returns an error if Project could not be found.
func (projectlist *ProjectList) GetProject(id int) (*Project, error) { func (projectlist *ProjectList) GetProject(id int) (*Project, error) {