INNER CODE UNIT · Go

BuildFieldSelector

ozontech/file.d · cfg/config.go:627

func BuildFieldSelector(fields []string) string {
	var builder strings.Builder
	for i, field := range fields {
		escaped := strings.ReplaceAll(field, ".", `\.`)
		builder.WriteString(escaped)
		if i != len(fields)-1 {
			builder.WriteByte('.')
		}
	}
	return builder.String()
}

// Parses several fields selectors and removes nested fields.
// If there are empty field selectors or no selectors at all error returned.
// For example:
// {"a", "a.b"} and {"a"} give the same results
// because field "a.b" is nested to field "a".
// Used in remove_fields plugin and keep_fields plugin

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…