I'm currently writing a program to query a database, store the results (most likely insert them into a new table) and then compare results I.e., I'll perform a query and store results, then requery an hour later and compare the results from an hour ago to check for changes.
I built structs for the tables such that:
type table1 struct {
id int
col1 string
col2 time.Time
}
type table2 struct{
id int
col1 string
col2 time.Time
}
I'm struggling with how to store the multiple row values into a struct in the simplest manner, then call it back and compare a field. I'll be comparing a specific field such as if t1.col1 == t2.col1 then check to see if this other field matches.
I'm not exactly sure how to store multiple rows into my struct easily though and then write it into a new table. So far I've figured that I'd use a slice of struct but I'm a little confused as to where to go from there/how to scan it in properly. I hope this is elaborated clearly. Thanks!
