Home / Function/ generateSlug() — graph2md Function Reference

generateSlug() — graph2md Function Reference

Architecture documentation for the generateSlug() function in main.go from the graph2md codebase.

Function go GraphIngestor Parser calls 2 called by 1

Entity Profile

Dependency Diagram

graph TD
  234fe91b_fb9f_ff66_8620_ad8caf50d9b1["generateSlug()"]
  80fa005d_7e3e_f056_f8f8_f520be5cd3e1["main.go"]
  234fe91b_fb9f_ff66_8620_ad8caf50d9b1 -->|defined in| 80fa005d_7e3e_f056_f8f8_f520be5cd3e1
  5ab9a7d2_746e_d880_5dc3_4ed8134ed871["main()"]
  5ab9a7d2_746e_d880_5dc3_4ed8134ed871 -->|calls| 234fe91b_fb9f_ff66_8620_ad8caf50d9b1
  4ac5d4d0_ee5a_6e77_e319_2b4ae2365a67["getStr()"]
  234fe91b_fb9f_ff66_8620_ad8caf50d9b1 -->|calls| 4ac5d4d0_ee5a_6e77_e319_2b4ae2365a67
  fee407d9_7c43_d137_4be8_0f44c679214c["toSlug()"]
  234fe91b_fb9f_ff66_8620_ad8caf50d9b1 -->|calls| fee407d9_7c43_d137_4be8_0f44c679214c
  style 234fe91b_fb9f_ff66_8620_ad8caf50d9b1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

main.go lines 2092–2153

func generateSlug(node Node, label string) string {
	props := node.Properties

	switch label {
	case "File":
		path := getStr(props, "path")
		if path == "" {
			return ""
		}
		return toSlug("file-" + path)
	case "Function":
		name := getStr(props, "name")
		filePath := getStr(props, "filePath")
		if name == "" {
			return ""
		}
		if filePath != "" {
			return toSlug("fn-" + filepath.Base(filePath) + "-" + name)
		}
		return toSlug("fn-" + name)
	case "Class":
		name := getStr(props, "name")
		filePath := getStr(props, "filePath")
		if name == "" {
			return ""
		}
		if filePath != "" {
			return toSlug("class-" + filepath.Base(filePath) + "-" + name)
		}
		return toSlug("class-" + name)
	case "Type":
		name := getStr(props, "name")
		filePath := getStr(props, "filePath")
		if name == "" {
			return ""
		}
		if filePath != "" {
			return toSlug("type-" + filepath.Base(filePath) + "-" + name)
		}
		return toSlug("type-" + name)
	case "Domain":
		name := getStr(props, "name")
		if name == "" {
			return ""
		}
		return toSlug("domain-" + name)
	case "Subdomain":
		name := getStr(props, "name")
		if name == "" {
			return ""
		}
		return toSlug("subdomain-" + name)
	case "Directory":
		path := getStr(props, "path")
		if path == "" || strings.Contains(path, "/app/repo-root/") {
			return ""
		}
		return toSlug("dir-" + path)
	default:
		return ""
	}
}

Domain

Subdomains

Defined In

Called By

Frequently Asked Questions

What does generateSlug() do?
generateSlug() is a function in the graph2md codebase, defined in main.go.
Where is generateSlug() defined?
generateSlug() is defined in main.go at line 2092.
What does generateSlug() call?
generateSlug() calls 2 function(s): getStr, toSlug.
What calls generateSlug()?
generateSlug() is called by 1 function(s): main.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free