From 13797c3b77b9e44860b47d381c9451d8ab70b14d Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Sun, 9 Sep 2018 20:14:52 +0200 Subject: person: add a function to test the matching of a query --- bug/person.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'bug/person.go') diff --git a/bug/person.go b/bug/person.go index 674da9f2..9afaac0d 100644 --- a/bug/person.go +++ b/bug/person.go @@ -2,6 +2,7 @@ package bug import ( "errors" + "strings" "github.com/MichaelMure/git-bug/repository" ) @@ -31,3 +32,8 @@ func GetUser(repo repository.Repo) (Person, error) { return Person{Name: name, Email: email}, nil } + +// Match tell is the Person match the given query string +func (p Person) Match(query string) bool { + return strings.Contains(strings.ToLower(p.Name), strings.ToLower(query)) +} -- cgit