package serialization

import (
	"fmt"
	"game/common/model/user"
	"testing"
	"time"
)

func Test_zz(t *testing.T) {
	us := &user.UserAccount{
		ID:            17,
		Username:      "test001",
		Password:      "123456",
		Email:         "",
		Phone:         "",
		DeviceID:      "",
		LastLoginIP:   "127.0.0.1",
		LastLoginTime: time.Now(),
		Status:        0,
		RegisterIP:    "",
		RegisterTime:  time.Now(),
	}
	maps := StructToMap(us)
	t.Log(maps)
	mapString := make(map[string]string)
	for key, value := range maps {
		mapString[key] = fmt.Sprintf("%v", value)
	}

	var err error
	us, err = MapToStruct[user.UserAccount](mapString)
	t.Log(err)
	t.Log(us)
}
