mercredi 1 mai 2019

Creating structs programmatically at runtime - possible?

Is it possible in Go to create a struct type programmatically (i.e. not in the compiled source code)?

We have a particular use case where a type will be created via user-defined metadata (so the schema/types are not known in advance) and will vary for every customer. We would then need to auto-generate REST services for those and persist them in a NoSQL backend. We would also need to define different dynamic validators per field (e.g. mandatory, regex, max/min size, max/min value, a reference to another type instance, etc.)

I was wondering if something similar is possible in the Go?





Aucun commentaire:

Enregistrer un commentaire