| 1 | import db.sqlite |
| 2 | import math |
| 3 | |
| 4 | struct Counter { |
| 5 | id int @[primary; sql: serial] |
| 6 | f f64 |
| 7 | } |
| 8 | |
| 9 | fn test_orm_or_block() { |
| 10 | db := sqlite.connect(':memory:') or { panic(err) } |
| 11 | |
| 12 | sql db { |
| 13 | drop table Counter |
| 14 | } or { println(math.e) } // this should compile |
| 15 | |
| 16 | x := sql db { |
| 17 | select from Counter |
| 18 | } or { |
| 19 | [Counter{ |
| 20 | f: math.pi |
| 21 | }] |
| 22 | } |
| 23 | assert x[0].f == math.pi |
| 24 | } |
| 25 |