From 4bbd98c9e2c054c54f2638a3f63bac94125ac238 Mon Sep 17 00:00:00 2001 From: Emin Date: Wed, 18 Oct 2023 11:58:57 +0300 Subject: [PATCH] Seach exact function --- internal/search.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/internal/search.go b/internal/search.go index 97d586a..4946be0 100644 --- a/internal/search.go +++ b/internal/search.go @@ -62,3 +62,19 @@ func searchInQueue(searchQuery string) []*Task { return results } + +func searchExactCredentials(sourceDetails, destinationDetails Credentials) []*Task { + var results []*Task + for i, e := 0, queue.Front(); i < queue.Len() && e != nil; i, e = i+1, e.Next() { + task := e.Value.(*Task) + if task.SourceAccount == sourceDetails.Account && + task.SourceServer == sourceDetails.Server && + task.SourcePassword == sourceDetails.Password && + task.DestinationAccount == destinationDetails.Account && + task.DestinationServer == destinationDetails.Server && + task.DestinationPassword == destinationDetails.Password { + results = append(results, task) + } + } + return results +}