Home / File/ main.go — graph2md Source File

main.go — graph2md Source File

Architecture documentation for main.go, a go file in the graph2md codebase. 1 imports, 0 dependents.

File go GraphIngestor Parser 1 imports 9 functions 14 classes

Entity Profile

Dependency Diagram

graph LR
  80fa005d_7e3e_f056_f8f8_f520be5cd3e1["main.go"]
  f056027b_f375_0788_d5af_0513f6006a9e["json"]
  80fa005d_7e3e_f056_f8f8_f520be5cd3e1 --> f056027b_f375_0788_d5af_0513f6006a9e
  style 80fa005d_7e3e_f056_f8f8_f520be5cd3e1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

package main

import (
	"encoding/json"
	"flag"
	"fmt"
	"html"
	"log"
	"os"
	"path/filepath"
	"regexp"
	"sort"
	"strings"
)

var nonAlnum = regexp.MustCompile(`[^a-z0-9]+`)

// toSlug converts a string to a URL-safe slug.
func toSlug(s string) string {
	s = strings.ToLower(s)
	s = nonAlnum.ReplaceAllString(s, "-")
	s = strings.Trim(s, "-")
	return s
}

// Graph JSON structures matching Supermodel API response

type APIResponse struct {
	Status string          `json:"status"`
	JobID  string          `json:"jobId"`
	Error  json.RawMessage `json:"error"`
	Result *GraphResult    `json:"result"`
}

type GraphResult struct {
	GeneratedAt string          `json:"generatedAt"`
	Message     string          `json:"message"`
	Stats       GraphStats      `json:"stats"`
	Graph       Graph           `json:"graph"`
	Metadata    json.RawMessage `json:"metadata"`
	Domains     []DomainSummary `json:"domains"`
	Artifacts   []Artifact      `json:"artifacts"`
}

type GraphStats struct {
	NodeCount         int            `json:"nodeCount"`
	RelationshipCount int            `json:"relationshipCount"`
	NodeTypes         map[string]int `json:"nodeTypes"`
	RelationshipTypes map[string]int `json:"relationshipTypes"`
}

type Graph struct {
	Nodes         []Node         `json:"nodes"`
	Relationships []Relationship `json:"relationships"`
}

type Node struct {
	ID         string                 `json:"id"`
	Labels     []string               `json:"labels"`
	Properties map[string]interface{} `json:"properties"`
// ... (2129 more lines)

Domain

Subdomains

Dependencies

  • json

Frequently Asked Questions

What does main.go do?
main.go is a source file in the graph2md codebase, written in go. It belongs to the GraphIngestor domain, Parser subdomain.
What functions are defined in main.go?
main.go defines 9 function(s): generateSlug, getNum, getStr, hasLabel, loadGraph, main, mermaidEscape, mermaidID, toSlug.
What does main.go depend on?
main.go imports 1 module(s): json.
Where is main.go in the architecture?
main.go is located at main.go (domain: GraphIngestor, subdomain: Parser).

Analyze Your Own Codebase

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

Try Supermodel Free