mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
mysql: fix for adapting mysql types to v structs (#15100)
This commit is contained in:
parent
041e90b2e2
commit
a13b8ff0c8
5 changed files with 185 additions and 15 deletions
|
@ -20,8 +20,11 @@
|
|||
|
||||
```v ignore
|
||||
struct Foo {
|
||||
id int [primary; sql: serial]
|
||||
name string [nonull]
|
||||
id int [primary; sql: serial]
|
||||
name string [nonull]
|
||||
created_at time.Time [sql_type: 'DATETIME']
|
||||
updated_at string [sql_type: 'DATETIME']
|
||||
deleted_at time.Time
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -45,7 +48,10 @@ sql db {
|
|||
|
||||
```v ignore
|
||||
var := Foo{
|
||||
name: 'abc'
|
||||
name: 'abc'
|
||||
created_at: time.now()
|
||||
updated_at: time.now().str()
|
||||
deleted_at: time.now()
|
||||
}
|
||||
|
||||
sql db {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue