Ompluscator / dynamic-struct

Golang package for editing struct's fields during runtime and mapping structs to other structs.
MIT License
683 stars 81 forks source link

convert interface to struct #13

Closed TahreemSaleem closed 4 years ago

TahreemSaleem commented 4 years ago

Hey! This may sound naive, I am new to Go. I was wondering if there is a way to convert interface returned by New() while building a dynamic struct to a struct type.

Ompluscator commented 4 years ago

Hi! Sorry for late response, I was on vacation :D

Nope, unfortunately, you can't cast it to any type. The only way to read values is to use Reader from this package, and to read values and map them to struct you want to have. Right now I'm working on package (convert-struct) which should give that possibility (in some way).

Integralist commented 4 years ago

🙏 for that new package 🙂