summary refs log tree commit diff stats
path: root/search
diff options
context:
space:
mode:
Diffstat (limited to 'search')
-rw-r--r--search/anagrams.go35
-rw-r--r--search/word.go21
2 files changed, 0 insertions, 56 deletions
diff --git a/search/anagrams.go b/search/anagrams.go
deleted file mode 100644
index e04dfd7..0000000
--- a/search/anagrams.go
+++ /dev/null
@@ -1,35 +0,0 @@
-package search
-
-import "tildegit.org/andinus/grus/storage"
-
-// Anagrams will search for unjumbled words in database, given sorted
-// word along with all the anagrams.
-func Anagrams(sorted string, db *storage.DB) (anagrams []string, err error) {
-	db.Mu.RLock()
-	defer db.Mu.RUnlock()
-
-	stmt, err := db.Conn.Prepare("SELECT word FROM words WHERE sorted = ?")
-	if err != nil {
-		return
-	}
-	defer stmt.Close()
-
-	rows, err := stmt.Query(sorted)
-	if err != nil {
-		return
-	}
-	defer rows.Close()
-	for rows.Next() {
-		var word string
-		err = rows.Scan(&word)
-		if err != nil {
-			return
-		}
-		anagrams = append(anagrams, word)
-	}
-	err = rows.Err()
-	if err != nil {
-		return
-	}
-	return
-}
diff --git a/search/word.go b/search/word.go
deleted file mode 100644
index c83c318..0000000
--- a/search/word.go
+++ /dev/null
@@ -1,21 +0,0 @@
-package search
-
-import "tildegit.org/andinus/grus/storage"
-
-// Word will search for unjumbled words in database, given sorted word.
-func Word(sorted string, db *storage.DB) (word string, err error) {
-	db.Mu.RLock()
-	defer db.Mu.RUnlock()
-
-	stmt, err := db.Conn.Prepare("SELECT word FROM words WHERE sorted = ?")
-	if err != nil {
-		return
-	}
-	defer stmt.Close()
-
-	err = stmt.QueryRow(sorted).Scan(&word)
-	if err != nil {
-		return
-	}
-	return
-}