mirror of
https://github.com/vlang/v.git
synced 2025-09-10 07:47:20 -04:00
orm: fix the old attribute syntax in the README's example, to the new @[attr]
form (#20305)
This commit is contained in:
parent
7fc31591ad
commit
7b04476683
@ -32,16 +32,16 @@ import time
|
|||||||
|
|
||||||
@[table: 'foos']
|
@[table: 'foos']
|
||||||
struct Foo {
|
struct Foo {
|
||||||
id int [primary; sql: serial]
|
id int @[primary; sql: serial]
|
||||||
name string
|
name string
|
||||||
created_at time.Time [default: 'CURRENT_TIME]
|
created_at time.Time @[default: 'CURRENT_TIME']
|
||||||
updated_at ?string [sql_type: 'TIMESTAMP]
|
updated_at ?string @[sql_type: 'TIMESTAMP']
|
||||||
deleted_at ?time.Time
|
deleted_at ?time.Time
|
||||||
children []Child [fkey: 'parent_id']
|
children []Child @[fkey: 'parent_id']
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Child {
|
struct Child {
|
||||||
id int [primary; sql: serial]
|
id int @[primary; sql: serial]
|
||||||
parent_id int
|
parent_id int
|
||||||
name string
|
name string
|
||||||
}
|
}
|
||||||
@ -131,9 +131,9 @@ result := sql db {
|
|||||||
import db.pg
|
import db.pg
|
||||||
|
|
||||||
struct Member {
|
struct Member {
|
||||||
id string [default: 'gen_random_uuid()'; primary; sql_type: 'uuid']
|
id string @[default: 'gen_random_uuid()'; primary; sql_type: 'uuid']
|
||||||
name string
|
name string
|
||||||
created_at string [default: 'CURRENT_TIMESTAMP'; sql_type: 'TIMESTAMP']
|
created_at string @[default: 'CURRENT_TIMESTAMP'; sql_type: 'TIMESTAMP']
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user