From c8745e1f60de70e5f535f926d41def8354e9cc30 Mon Sep 17 00:00:00 2001 From: Yevhen Odynets Date: Tue, 28 Oct 2025 12:59:54 +0200 Subject: [PATCH] some mirror fixed --- install.sh | 2 ++ pkg/repository/table/external_sources.go | 5 +++++ 2 files changed, 7 insertions(+) create mode 100644 install.sh diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..f0d5843 --- /dev/null +++ b/install.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +env GOBIN=/usr/local/bin go install ./cmd \ No newline at end of file diff --git a/pkg/repository/table/external_sources.go b/pkg/repository/table/external_sources.go index 9604200..e26fe36 100644 --- a/pkg/repository/table/external_sources.go +++ b/pkg/repository/table/external_sources.go @@ -67,6 +67,11 @@ func BatchInsertOnDuplicate(entries []model.ExternalSources, db *sqlx.DB, column } func (f *ExternalSources) GetTypeIds(entries []model.ExternalSources, db *sqlx.DB) []int { + if len(entries) == 0 { + fmt.Printf("Entries are empty") + return nil // або логування помилки + } + var typeIds []int ids := thither.FieldValueToStrSlice(entries, "TypeId") query := fmt.Sprintf("SELECT type_id FROM %s WHERE `type` = '%s' AND type_id IN (%s) LIMIT %d", constant.ExternalSourcesTable, entries[0].Type, strings.Join(ids, ","), len(ids))