Cleaning stuff out a bit... Need to work towards querying.

This commit is contained in:
Alex Stevenson 2025-07-29 21:07:49 -04:00
parent 893faf8988
commit edbdfe3afc
4 changed files with 10 additions and 26 deletions

Binary file not shown.

34
main.go
View file

@ -21,19 +21,8 @@ type ActiveSqliteRow struct {
id int
table_name string
columns []string
// values map[string]
}
/*
func (r ActiveSqliteRow) init(t string, i int) bool{
log.Print("In init with" + t)
log.Print(i)
r.id = i
r.table_name = t
return true
}
*/
type Entity struct {
id int
user_id int
@ -63,23 +52,12 @@ func check(e error) {
}
}
func main() {
dat, err := os.ReadFile("setup.sql")
check(err)
log.Printf("contents: \n\n%s", dat)
func reset_database(db *sql.DB) {
dat, _ := os.ReadFile("setup.sql")
queries := strings.Split(string(dat), ";")
log.Print(queries)
db, err := sql.Open("sqlite3", "rpgqui.db")
check(err)
for i, q := range queries {
log.Println(i, q)
log.Println(i)
res, err := db.Exec(q)
check(err)
@ -87,3 +65,9 @@ func main() {
log.Println(res)
}
}
func main() {
db, _ := sql.Open("sqlite3", "rpgqui.db")
reset_database(db)
}

BIN
rpgqui.db

Binary file not shown.

View file

@ -12,4 +12,4 @@ CREATE TABLE IF NOT EXISTS entities (
name VARCHAR(64),
spawn_line VARCHAR(64),
FOREIGN KEY(user_id) REFERENCES users(id)
);
);