Started transforming tags into relationships.

This commit is contained in:
Jay
2025-02-24 11:45:23 -05:00
parent 1bb73d7712
commit 13724ce56f
7 changed files with 244 additions and 47 deletions

View File

@@ -346,36 +346,3 @@ func DeserializeRelKey(sortKey string) (string, string, string) {
rtype, startLabel, endLabel := parts[0], parts[1], parts[2]
return rtype, startLabel, endLabel
}
// ========================================
// Cypher Formatting Functions
// ========================================
// ToCypherLabel converts a node label or relationship type into its Cypher
// format.
func ToCypherLabel(label string) string {
return fmt.Sprintf(":`%s`", label)
}
// ToCypherLabels converts a list of node labels into its Cypher format.
func ToCypherLabels(labels []string) string {
var cypherLabels []string
for _, label := range labels {
cypherLabels = append(cypherLabels, ToCypherLabel(label))
}
return strings.Join(cypherLabels, "")
}
func ToCypherProps(keys []string, prefix string) string {
if prefix == "" {
prefix = "$"
}
cypherPropsParts := []string{}
for _, key := range keys {
cypherPropsParts = append(
cypherPropsParts, fmt.Sprintf("%s: %s%s", key, prefix, key))
}
return strings.Join(cypherPropsParts, ", ")
}