Shop improvements

This commit is contained in:
2017-10-04 08:12:12 +02:00
parent aec23d0b6e
commit 16ab79b3a8
13 changed files with 134 additions and 53 deletions

View File

@ -12,18 +12,15 @@ func main() {
// Get a stream of all users
allUsers, err := arn.StreamUsers()
if err != nil {
panic(err)
}
arn.PanicOnError(err)
// Iterate over the stream
for user := range allUsers {
// exists, err := arn.DB.Exists("UserFollows", user.ID)
exists, err := arn.DB.Exists("UserFollows", user.ID)
// if err != nil || exists {
// continue
// }
if err != nil || exists {
continue
}
fmt.Println(user.Nick)

View File

@ -0,0 +1,36 @@
package main
import (
"fmt"
"github.com/animenotifier/arn"
"github.com/fatih/color"
)
func main() {
color.Yellow("Adding inventories to users who don't have one")
// Get a stream of all users
allUsers, err := arn.StreamUsers()
arn.PanicOnError(err)
// Iterate over the stream
for user := range allUsers {
exists, err := arn.DB.Exists("Inventory", user.ID)
if err != nil || exists {
continue
}
fmt.Println(user.Nick)
inventory := arn.NewInventory(user.ID)
err = arn.DB.Set("Inventory", inventory.UserID, inventory)
if err != nil {
color.Red(err.Error())
}
}
color.Green("Finished.")
}