From cb649e8d56e3be0d0bc9072f7e00b6adf8b9c82d Mon Sep 17 00:00:00 2001 From: Jin Hai Date: Mon, 10 Aug 2026 18:50:37 +0800 Subject: [PATCH] Go: fix warning (#18058) Signed-off-by: Jin Hai --- internal/dao/canvas_template_seed.go | 6 +++--- internal/dao/langfuse.go | 2 +- internal/dao/pipeline_operation_log.go | 2 +- internal/dao/sync_task.go | 5 ----- internal/dao/user_canvas.go | 5 ----- 5 files changed, 5 insertions(+), 15 deletions(-) diff --git a/internal/dao/canvas_template_seed.go b/internal/dao/canvas_template_seed.go index 9bac66c47f..22b58dd7ce 100644 --- a/internal/dao/canvas_template_seed.go +++ b/internal/dao/canvas_template_seed.go @@ -198,10 +198,10 @@ func parseCanvasTemplateFile(raw []byte) (*entity.CanvasTemplate, error) { tmpl.ID = fmt.Sprint(v) } if v, ok := data["title"].(map[string]any); ok { - tmpl.Title = entity.JSONMap(v) + tmpl.Title = v } if v, ok := data["description"].(map[string]any); ok { - tmpl.Description = entity.JSONMap(v) + tmpl.Description = v } if v, ok := data["avatar"].(string); ok && v != "" { tmpl.Avatar = &v @@ -219,7 +219,7 @@ func parseCanvasTemplateFile(raw []byte) (*entity.CanvasTemplate, error) { } if v, ok := data["dsl"].(map[string]any); ok { - tmpl.DSL = entity.JSONMap(v) + tmpl.DSL = v } return tmpl, nil diff --git a/internal/dao/langfuse.go b/internal/dao/langfuse.go index c8109f67ea..a748c8709c 100644 --- a/internal/dao/langfuse.go +++ b/internal/dao/langfuse.go @@ -36,7 +36,7 @@ func NewLangfuse() *LangfuseDAO { // GetByTenantID returns the Langfuse credentials row for a tenant. // It returns (nil, nil) when no row exists, mirroring the Python -// TenantLangfuseService.filter_by_tenant behaviour (DoesNotExist -> None). +// TenantLangfuseService.filter_by_tenant behavior (DoesNotExist -> None). func (dao *LangfuseDAO) GetByTenantID(ctx context.Context, db *gorm.DB, tenantID string) (*entity.TenantLangfuse, error) { var row entity.TenantLangfuse err := db.WithContext(ctx).Where("tenant_id = ?", tenantID).First(&row).Error diff --git a/internal/dao/pipeline_operation_log.go b/internal/dao/pipeline_operation_log.go index abffe25481..ee95738a1b 100644 --- a/internal/dao/pipeline_operation_log.go +++ b/internal/dao/pipeline_operation_log.go @@ -77,7 +77,7 @@ func NewPipelineOperationLogDAO() *PipelineOperationLogDAO { // GetDatasetLogsByKBID lists dataset-level (graph/raptor/mindmap) ingestion // logs for a knowledge base. Pagination is only applied when both page and -// pageSize are positive, matching peewee's paginate behaviour. +// pageSize are positive, matching peewee's paginate behavior. func (dao *PipelineOperationLogDAO) GetDatasetLogsByKBID(ctx context.Context, db *gorm.DB, kbID string, page, pageSize int, orderby string, desc bool, operationStatus []string, createDateFrom, createDateTo, keywords string) ([]*entity.PipelineOperationLog, int64, error) { query := db.WithContext(ctx).Model(&entity.PipelineOperationLog{}). Where("kb_id = ? AND document_id = ?", kbID, graphRaptorFakeDocID) diff --git a/internal/dao/sync_task.go b/internal/dao/sync_task.go index abb0961a57..748bc09d01 100644 --- a/internal/dao/sync_task.go +++ b/internal/dao/sync_task.go @@ -369,8 +369,3 @@ func syncConnectorConfigBool(config map[string]any, key string) bool { return false } } - -// IsNotFound reports whether an error is a gorm not found error. -func IsNotFound(err error) bool { - return errors.Is(err, gorm.ErrRecordNotFound) -} diff --git a/internal/dao/user_canvas.go b/internal/dao/user_canvas.go index ecd9a896ee..405aa31a0e 100644 --- a/internal/dao/user_canvas.go +++ b/internal/dao/user_canvas.go @@ -69,11 +69,6 @@ func userCanvasQualifiedOrderClause(orderby string, desc bool) string { return order + " ASC" } -func escapeSQLLike(s string) string { - replacer := strings.NewReplacer(`\`, `\\`, `%`, `\%`, `_`, `\_`) - return replacer.Replace(s) -} - func splitUserCanvasTags(raw string) []string { parts := strings.Split(raw, ",") tags := make([]string, 0, len(parts))