Advertisement
Guest User

Untitled

a guest
Oct 1st, 2019
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nim 0.39 KB | None | 0 0
  1. import macros, db_sqlite, jester
  2.  
  3. var db: DbConn
  4.  
  5. iterator all*(T: typedesc): T =
  6.   for row in db.fastRows sql "blah":
  7.     let obj = T()
  8.     for val in obj[].fields:
  9.       when val is Ordinal:
  10.         val = typeof(val) parseInt row[i] ## this is the line that causes error... in the full example
  11.     yield obj
  12.  
  13. type Foo = ref object
  14.  
  15. routes:
  16.   get "/":
  17.     for x in all Foo: discard
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement