all: replace struct field name '@type' with 'type' (#22485)

This commit is contained in:
yuyi 2024-10-11 13:53:18 +08:00 committed by GitHub
parent 9788ae1f3e
commit 79786732ef
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 52 additions and 52 deletions

View file

@ -29,7 +29,7 @@ pub struct C.MYSQL_FIELD {
flags u32 // Bit-flags that describe the field
decimals u32 // Number of decimals in field
charsetnr u32 // Character set
@type int // Type of field. See enums.v for types
type int // Type of field. See enums.v for types
}
// C.mysql_init allocates or initializes a MYSQL object suitable for `mysql_real_connect()`.

View file

@ -26,7 +26,7 @@ pub fn (db DB) @select(config orm.SelectConfig, data orm.QueryData, where orm.Qu
// Allocate memory for each column.
for i in 0 .. num_fields {
field := unsafe { fields[i] }
match unsafe { FieldType(field.@type) } {
match unsafe { FieldType(field.type) } {
.type_tiny {
data_pointers << unsafe { malloc(1) }
}
@ -48,7 +48,7 @@ pub fn (db DB) @select(config orm.SelectConfig, data orm.QueryData, where orm.Qu
data_pointers << &u8(0)
}
else {
return error('\'${unsafe { FieldType(field.@type) }}\' is not yet implemented. Please create a new issue at https://github.com/vlang/v/issues/new')
return error('\'${unsafe { FieldType(field.type) }}\' is not yet implemented. Please create a new issue at https://github.com/vlang/v/issues/new')
}
}
}
@ -68,7 +68,7 @@ pub fn (db DB) @select(config orm.SelectConfig, data orm.QueryData, where orm.Qu
for i, mut mysql_bind in stmt.res {
field := unsafe { fields[i] }
field_type := unsafe { FieldType(field.@type) }
field_type := unsafe { FieldType(field.type) }
field_types << field_type
match types[i] {
@ -87,7 +87,7 @@ pub fn (db DB) @select(config orm.SelectConfig, data orm.QueryData, where orm.Qu
}
.type_string, .type_blob {}
else {
return error('Unknown type ${field.@type}')
return error('Unknown type ${field.type}')
}
}
}

View file

@ -30,7 +30,7 @@ pub struct Field {
flags u32
decimals u32
charsetnr u32
type_ FieldType
type FieldType
}
// fetch_row fetches the next row from a result.
@ -112,7 +112,7 @@ pub fn (r Result) fields() []Field {
flags: orig_fields.flags
decimals: orig_fields.decimals
charsetnr: orig_fields.charsetnr
type_: FieldType(orig_fields.@type)
type: FieldType(orig_fields.type)
}
}
}
@ -142,7 +142,7 @@ pub fn (f Field) str() string {
flags: ${f.flags}
decimals: ${f.decimals}
charsetnr: ${f.charsetnr}
type: ${f.type_.str()}
type: ${f.type.str()}
}
'
}

View file

@ -268,7 +268,7 @@ pub fn (mut stmt Stmt) bind(typ int, buffer voidptr, buf_len u32) {
pub fn (mut stmt Stmt) bind_res(fields &C.MYSQL_FIELD, dataptr []&u8, lengths []u32, num_fields int) {
for i in 0 .. num_fields {
stmt.res << C.MYSQL_BIND{
buffer_type: unsafe { fields[i].@type }
buffer_type: unsafe { fields[i].type }
buffer: dataptr[i]
length: &lengths[i]
}