44 lines
746 B
Go
Raw Normal View History

package main
2017-07-12 18:37:34 +00:00
import (
"github.com/animenotifier/arn"
"github.com/fatih/color"
)
func main() {
2017-07-12 18:37:34 +00:00
color.Yellow("Deleting private user data")
// Get a stream of all users
allUsers, err := arn.StreamUsers()
if err != nil {
panic(err)
}
arn.DB.DeleteTable("EmailToUser")
arn.DB.DeleteTable("GoogleToUser")
// Iterate over the stream
count := 0
for user := range allUsers {
count++
println(count, user.Nick)
// Delete private data
user.Email = ""
user.Gender = ""
user.FirstName = ""
user.LastName = ""
user.IP = ""
user.Accounts.Facebook.ID = ""
user.Accounts.Google.ID = ""
user.AgeRange = arn.UserAgeRange{}
user.Location = arn.UserLocation{}
// Save in DB
user.Save()
}
color.Green("Finished.")
}