Directus / @directus/sdk / rest / updateField
Function: updateField() ​
updateField<
Schema
,TQuery
>(collection
,field
,item
,query
?):RestCommand
<IfAny
<Schema
,Record
<string
,any
>, { [K in string | number | symbol]: Merge<MappedFunctionFields<Schema, DirectusField<Schema>> extends FF ? MapFlatFields<DirectusField<Schema>, FieldsWildcard<DirectusField<Schema>, Exclude<UnpackList<Mutable<(...)>>, PickRelationalFields<(...)> extends never ? never : AllKeys<(...)>>>, FF extends Record<string, string> ? FF<FF> : Record<string, string>> : never, PickRelationalFields<UnpackList<Mutable<TQuery["fields"]>>> extends never ? never : { [Field in string | number | symbol]: Field extends keyof DirectusField<Schema> ? Extract<(...)[(...)], ItemType<(...)>> extends RelatedCollection ? IsNullable<(...)[(...)], (...) | (...), (...) extends (...) ? (...) : (...)> : never : never }>[K] }>,Schema
>
Updates the given field in the given collection.
Type Parameters ​
• Schema
• TQuery extends Query
<Schema
, DirectusField
<Schema
>>
Parameters ​
• collection: string
• field: string
• item
• item.collection?: string
• item.field?: string
• item.meta?: NestedUnion
<IfAny
<Schema
, object
, "directus_fields"
extends keyof Schema
? UnpackList
<Schema
[keyof Schema
& "directus_fields"
]> extends Item
? { [Field in string | number | symbol]: Item[Field] } & object
: never
: object
>>
• item.schema?
• item.schema.comment?: null
| string
• item.schema.data_type?: string
• item.schema.default_value?: any
• item.schema.foreign_key_column?: null
| string
• item.schema.foreign_key_schema?: null
| string
• item.schema.foreign_key_table?: null
| string
• item.schema.generation_expression?: unknown
• item.schema.has_auto_increment?: boolean
• item.schema.is_generated?: boolean
• item.schema.is_indexed?: boolean
• item.schema.is_nullable?: boolean
• item.schema.is_primary_key?: boolean
• item.schema.is_unique?: boolean
• item.schema.max_length?: null
| number
• item.schema.name?: string
• item.schema.numeric_precision?: null
| number
• item.schema.numeric_scale?: null
| number
• item.schema.schema?: string
• item.schema.table?: string
• item.type?: string
• query?: TQuery
Returns ​
RestCommand
<IfAny
<Schema
, Record
<string
, any
>, { [K in string | number | symbol]: Merge<MappedFunctionFields<Schema, DirectusField<Schema>> extends FF ? MapFlatFields<DirectusField<Schema>, FieldsWildcard<DirectusField<Schema>, Exclude<UnpackList<Mutable<(...)>>, PickRelationalFields<(...)> extends never ? never : AllKeys<(...)>>>, FF extends Record<string, string> ? FF<FF> : Record<string, string>> : never, PickRelationalFields<UnpackList<Mutable<TQuery["fields"]>>> extends never ? never : { [Field in string | number | symbol]: Field extends keyof DirectusField<Schema> ? Extract<(...)[(...)], ItemType<(...)>> extends RelatedCollection ? IsNullable<(...)[(...)], (...) | (...), (...) extends (...) ? (...) : (...)> : never : never }>[K] }>, Schema
>
Throws ​
Will throw if collection is empty
Throws ​
Will throw if field is empty