mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
docs: add missing User and Post declarations in the Generics example
This commit is contained in:
12
doc/docs.md
12
doc/docs.md
@@ -2462,6 +2462,18 @@ struct Repo<T> {
|
|||||||
db DB
|
db DB
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct User {
|
||||||
|
id int
|
||||||
|
name string
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Post {
|
||||||
|
id int
|
||||||
|
user_id int
|
||||||
|
title string
|
||||||
|
body string
|
||||||
|
}
|
||||||
|
|
||||||
fn new_repo<T>(db DB) Repo<T> {
|
fn new_repo<T>(db DB) Repo<T> {
|
||||||
return Repo<T>{db: db}
|
return Repo<T>{db: db}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user