SHARE
TWEET

Untitled

a guest Oct 1st, 2019 130 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top