forked from mirrors/homebox
fix: csv-importer (#10)
* update item fields to support import_ref * add additional rows to CSV importer * add CSV import documentation * update readme * update readme * fix failed test
This commit is contained in:
parent
90813abf76
commit
ca36e3b080
21 changed files with 447 additions and 135 deletions
|
@ -694,6 +694,12 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
|||
Column: item.FieldDescription,
|
||||
})
|
||||
}
|
||||
if iu.mutation.ImportRefCleared() {
|
||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Column: item.FieldImportRef,
|
||||
})
|
||||
}
|
||||
if value, ok := iu.mutation.Notes(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
|
@ -1834,6 +1840,12 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error)
|
|||
Column: item.FieldDescription,
|
||||
})
|
||||
}
|
||||
if iuo.mutation.ImportRefCleared() {
|
||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
Column: item.FieldImportRef,
|
||||
})
|
||||
}
|
||||
if value, ok := iuo.mutation.Notes(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeString,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue