status-im/nim-stew

getCustomPragmaFixed does not support more than one pragma parameter

Closed this issue · 0 comments

from macros import getCustomPragmaVal
from stew/shims/macros as stew_macros import hasCustomPragmaFixed, getCustomPragmaFixed

template dbColumnName*(name: string, primaryKey: bool = false) {.pragma.}
    ## Specifies the database column name for the object property

type MyType = object
  name {.dbColumnName("blah", true).}: string

let myType = MyType(name: "eric")

echo type myType.type.getCustomPragmaFixed("name", dbColumnName)
echo type myType.name.getCustomPragmaVal(dbColumnName)

Expected results:

tuple[name: string, primaryKey: bool]
tuple[name: string, primaryKey: bool]

Actual results:

Error Type
tuple[name: string, primaryKey: bool]

Reproduction:

git clone https://github.com/emizzle/nim-test-env && cd nim-test-env
make get_custom_pragma