mirror of
https://github.com/vlang/v.git
synced 2025-09-08 14:51:53 -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']
|
||||
struct Foo {
|
||||
id int [primary; sql: serial]
|
||||
id int @[primary; sql: serial]
|
||||
name string
|
||||
created_at time.Time [default: 'CURRENT_TIME]
|
||||
updated_at ?string [sql_type: 'TIMESTAMP]
|
||||
created_at time.Time @[default: 'CURRENT_TIME']
|
||||
updated_at ?string @[sql_type: 'TIMESTAMP']
|
||||
deleted_at ?time.Time
|
||||
children []Child [fkey: 'parent_id']
|
||||
children []Child @[fkey: 'parent_id']
|
||||
}
|
||||
|
||||
struct Child {
|
||||
id int [primary; sql: serial]
|
||||
id int @[primary; sql: serial]
|
||||
parent_id int
|
||||
name string
|
||||
}
|
||||
@ -131,9 +131,9 @@ result := sql db {
|
||||
import db.pg
|
||||
|
||||
struct Member {
|
||||
id string [default: 'gen_random_uuid()'; primary; sql_type: 'uuid']
|
||||
id string @[default: 'gen_random_uuid()'; primary; sql_type: 'uuid']
|
||||
name string
|
||||
created_at string [default: 'CURRENT_TIMESTAMP'; sql_type: 'TIMESTAMP']
|
||||
created_at string @[default: 'CURRENT_TIMESTAMP'; sql_type: 'TIMESTAMP']
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user