package main import ( "context" "fmt" "github.com/Leufolium/test/mongo" goproto "google.golang.org/protobuf/proto" ) func main() { fmt.Println("Start importing...") client, err := mongo.NewMongo() if err != nil { fmt.Printf("mongo client init fail : %v", err) return } ctx := context.Background() list, _ := client.GetAccountList(ctx) fmt.Printf("共%v个account待更新", len(list)) for _, account := range list { account.UserIdString = goproto.String(fmt.Sprint(*account.UserId)) client.UpdateAccount(ctx, account) } fmt.Println("End importing...") }