Heyho,
While coding my way through some generics I stumbled upon an issue with one of my generic functions. I have 2 types such as this
import std/options
import norm
type
A = ref object of Model
name: string
B = ref object of Model
name: string
myA: Option[A]
norm, an ORM in nim for sqlite, has the capability for me to grab the sql-tablename a model belongs to at compile time by just having a type that inherits from Model and calling table()
on it.
For various reasons I want to be able to figure out the name of all tables, that a given Model links to. In this case, B
links to the type A
, but I need to call A.table()
to get that tablename at compile-time (which could be anything if the {.tableName.}
pragma is in use).
However, I can't seem to find a way to access my type, since I can't call the typical get()
method of the options
module at compile time. What is my way out here?