fixing tabs

This commit is contained in:
Alex Stevenson 2025-07-25 19:14:06 -04:00
parent 040633b7be
commit 0c8bd064e3
2 changed files with 13 additions and 14 deletions

27
main.go
View file

@ -5,16 +5,15 @@ import (
"log" "log"
_ "github.com/mattn/go-sqlite3" _ "github.com/mattn/go-sqlite3"
) )
// Book is a placeholder for book // Book is a placeholder for book
type Word struct { type Word struct {
word_id int source_id int
source_id int previous string
previous string
current string current string
next string next string
count int count int
} }
type Source struct { type Source struct {
@ -60,14 +59,14 @@ func main() {
FOREIGN KEY(source_id) REFERENCES sources(source_id) FOREIGN KEY(source_id) REFERENCES sources(source_id)
); );
`).Exec() `).Exec()
log.Println("Done making tables!") log.Println("Done making tables!")
log.Println("Making indexes...") log.Println("Making indexes...")
prep_query(db, "CREATE INDEX words_sources_index ON words(source_id)").Exec() prep_query(db, "CREATE INDEX words_sources_index ON words(source_id)").Exec()
log.Println("Done making indexes!") log.Println("Done making indexes!")
log.Println("Inserting source/word...") log.Println("Inserting source/word...")
prep_query(db, ` prep_query(db, `
INSERT INTO sources INSERT INTO sources
(name) (name)
VALUES VALUES
@ -100,8 +99,8 @@ func main() {
tempWord.word_id, tempWord.current, tempWord.next, tempWord.source_id) tempWord.word_id, tempWord.current, tempWord.next, tempWord.source_id)
} }
// Update // Update
prep_query(db, "UPDATE sources SET name=? WHERE source_id=?").Exec("Monqu2", 1) prep_query(db, "UPDATE sources SET name=? WHERE source_id=?").Exec("Monqu2", 1)
rows, _ = db.Query("SELECT source_id, name FROM sources") rows, _ = db.Query("SELECT source_id, name FROM sources")
for rows.Next() { for rows.Next() {

BIN
words.db

Binary file not shown.