summary refs log tree commit diff stats
path: root/cache/index.go
diff options
context:
space:
mode:
authorBen Morrison <ben@gbmor.dev>2019-05-14 00:08:38 -0400
committerBen Morrison <ben@gbmor.dev>2019-05-14 00:08:38 -0400
commitfae46db2e7716a273a02a5bf52f8a0b78bcb23c8 (patch)
tree5159206d6ae72426a74234cae5496e3c77ac9a0c /cache/index.go
parent9f141b4a31c5c94275d5010cc92e9631237ab0d8 (diff)
downloadgetwtxt-fae46db2e7716a273a02a5bf52f8a0b78bcb23c8.tar.gz
partially finished QueryUser() method. still needs sorting before return
Diffstat (limited to 'cache/index.go')
-rw-r--r--cache/index.go23
1 files changed, 23 insertions, 0 deletions
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")
+
+	//}
+}