Go: fix warning (#18058)

Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
Jin Hai
2026-08-10 18:50:37 +08:00
committed by GitHub
parent eb184c839c
commit cb649e8d56
5 changed files with 5 additions and 15 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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)

View File

@@ -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)
}

View File

@@ -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))