dtp/cmd/main.go

32 lines
584 B
Go
Raw Normal View History

2023-12-24 15:29:12 +08:00
package main
import (
"context"
"fmt"
"github.com/Leufolium/test/mongo"
2023-12-24 22:22:45 +08:00
goproto "google.golang.org/protobuf/proto"
2023-12-24 15:29:12 +08:00
)
func main() {
fmt.Println("Start importing...")
client, err := mongo.NewMongo()
if err != nil {
fmt.Printf("mongo client init fail : %v", err)
return
}
2024-03-16 23:39:10 +08:00
ctx := context.Background()
2024-03-16 23:54:18 +08:00
list, _ := client.GetAccountList(ctx)
fmt.Printf("共%v个account待更新", len(list))
for _, account := range list {
2024-03-16 23:39:10 +08:00
account.UserIdString = goproto.String(fmt.Sprint(*account.UserId))
client.UpdateAccount(ctx, account)
2023-12-24 15:29:12 +08:00
}
fmt.Println("End importing...")
}