MCPcopy Index your code
hub / github.com/expr-lang/expr / fields

Function fields

docgen/markdown.go:81–118  ·  view source on GitHub ↗
(t *Type)

Source from the content-addressed store, hash-verified

79}
80
81func fields(t *Type) string {
82 var fields []string
83 for field := range t.Fields {
84 fields = append(fields, string(field))
85 }
86 sort.Strings(fields)
87
88 out := ""
89 foundFields := false
90 for _, name := range fields {
91 v := t.Fields[Identifier(name)]
92 if v.Kind != "func" {
93 if !foundFields {
94 out += "| Field | Type |\n|---|---|\n"
95 }
96 foundFields = true
97
98 out += fmt.Sprintf("| %v | %v |\n", name, link(v))
99 }
100 }
101 foundMethod := false
102 for _, name := range fields {
103 v := t.Fields[Identifier(name)]
104 if v.Kind == "func" {
105 if !foundMethod {
106 out += "\n| Method | Returns |\n|---|---|\n"
107 }
108 foundMethod = true
109
110 args := make([]string, len(v.Arguments))
111 for i, arg := range v.Arguments {
112 args[i] = link(arg)
113 }
114 out += fmt.Sprintf("| %v(%v) | %v |\n", name, strings.Join(args, ", "), link(v.Return))
115 }
116 }
117 return out
118}

Callers 1

MarkdownMethod · 0.85

Calls 3

IdentifierTypeAlias · 0.85
linkFunction · 0.85
SprintfMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…