From fae46db2e7716a273a02a5bf52f8a0b78bcb23c8 Mon Sep 17 00:00:00 2001 From: Ben Morrison Date: Tue, 14 May 2019 00:08:38 -0400 Subject: partially finished QueryUser() method. still needs sorting before return --- cache/index.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'cache/index.go') diff --git a/cache/index.go b/cache/index.go index 641e6dc..0cf8065 100644 --- a/cache/index.go +++ b/cache/index.go @@ -2,6 +2,7 @@ package cache import ( "log" + "strings" "time" ) @@ -27,3 +28,25 @@ func (index UserIndex) DelUser(url string) { delete(index, url) imutex.Unlock() } + +func (index UserIndex) QueryUser(name string) []string { + var users []string + var entry string + for k, v := range index { + if strings.Contains(v.nick, name) { + entry = v.nick + "\t" + k + "\t" + string(v.apidate) + users = append(users, entry) + } + } + + return users +} + +// FindTag takes a user's tweets and looks for a given tag. +// Returns the tweets with the tag as a []string. +func (userdata *Data) FindTag(tag string) { + //for _, e := range userdata.status { + //parts := strings.Split(e, "\t") + + //} +} -- cgit 1.4.1-2-gfad0