-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[orm] pass generic types #24041
Comments
Connected to Huly®: V_0.6-22433 |
I think this code should work module main
import db.sqlite
pub struct Message[T] {
id int
T
}
// usage
struct Payload {
some_filed_1 string
some_filed_2 int
}
fn test_handler(message Message[Payload]) ! {
return error('AAAA')
}
fn main() {
db_path := 'test_queue.db'
mut conn := sqlite.connect(db_path) or { panic('Failed to connect to database: ${err}') }
sql conn {
create table Message[Payload]
}!
}
But I get this error:
|
this code compiled module main
import db.sqlite
pub struct Message {
Payload
id int
}
// usage
struct Payload {
some_filed_1 string
some_filed_2 int
}
fn test_handler(message Message) ! {
return error('AAAA')
}
fn main() {
db_path := 'test_queue.db'
mut conn := sqlite.connect(db_path) or { panic('Failed to connect to database: ${err}') }
sql conn {
create table Message
}!
} but at run i get this error:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
V version: V 0.4.9 1d9aa88, press to see full `v doctor` output
What did you do?
./v -g -o vdbg cmd/v && ./vdbg .\main.v && C:\dev\mam_prod\v\litequeue\litequeue\orm_gen\main.exe
What did you see?
What did you expect to see?
Must compile and works
Note
You can use the 👍 reaction to increase the issue's priority for developers.
Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.
The text was updated successfully, but these errors were encountered: