in internal/database/postgres/postgres.go [240:273]
func (h postgresHandler) generateMetadataComment(data *database.CommentData, enrichments map[string]bool) string {
if data == nil {
return ""
}
if data.TableName == "" || data.ColumnName == "" {
return ""
}
var commentParts []string
// Helper function to check if enrichment is requested
isEnrichmentRequested := func(enrichment string) bool {
if len(enrichments) == 0 {
return true // If no enrichments specified, include all
}
return enrichments[enrichment]
}
if isEnrichmentRequested("description") && data.Description != "" {
commentParts = append(commentParts, fmt.Sprintf("*Important Note*: %s", data.Description))
}
if isEnrichmentRequested("examples") && len(data.ExampleValues) > 0 {
commentParts = append(commentParts, fmt.Sprintf("Example Values: %s", h.formatExampleValues(data.ExampleValues)))
}
if isEnrichmentRequested("distinct_values") {
commentParts = append(commentParts, fmt.Sprintf("Count Distinct Values: %d", data.DistinctCount))
}
if isEnrichmentRequested("null_count") {
commentParts = append(commentParts, fmt.Sprintf("Count Null: %d", data.NullCount))
}
return strings.Join(commentParts, " | ")
}