orm: add unique fields & add drop table stmt (#9684)

This commit is contained in:
Louis Schmieder 2021-04-11 23:57:25 +02:00 committed by GitHub
parent b0b3c51658
commit 67d8639917
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 101 additions and 7 deletions

View file

@ -10,15 +10,14 @@ struct Module {
struct User {
id int [primary; sql: serial]
age int
name string [nonull]
is_customer bool
age int [unique: 'user']
name string [unique]
is_customer bool [unique: 'user']
skipped_string string [skip]
}
fn main() {
db := sqlite.connect(':memory:') or { panic(err) }
db.exec('drop table if exists User')
sql db {
create table Module
}
@ -40,6 +39,10 @@ fn main() {
select from Module where id == 1
}
sql db {
drop table Module
}
eprintln(modul)
mysql()