MCPcopy Create free account
hub / github.com/goadesign/goa / UserTypeLocation

Function UserTypeLocation

codegen/import.go:79–92  ·  view source on GitHub ↗

UserTypeLocation returns the location of the user type if set via the struct:pkg:path metadata, nil otherwise..

(dt expr.DataType)

Source from the content-addressed store, hash-verified

77// UserTypeLocation returns the location of the user type if set via the
78// struct:pkg:path metadata, nil otherwise..
79func UserTypeLocation(dt expr.DataType) *Location {
80 ut, ok := dt.(expr.UserType)
81 if !ok {
82 return nil
83 }
84 p, ok := ut.Attribute().Meta.Last("struct:pkg:path")
85 if !ok || p == "" {
86 return nil
87 }
88 return &Location{
89 FilePath: filepath.Join(filepath.FromSlash(p), SnakeCase(ut.Name())+".go"),
90 RelImportPath: p,
91 }
92}
93
94// PackageName returns the package name of the given location.
95func (loc *Location) PackageName() string {

Callers 15

clientTypeFunction · 0.92
transformUnionDataFunction · 0.92
serverTypeFunction · 0.92
ConvertFilesFunction · 0.92
analyzeMethod · 0.92
collectTypesFunction · 0.92
collectUnionTypesFunction · 0.92
buildUnionTypeDataFunction · 0.92
buildErrorInitDataFunction · 0.92
buildMethodDataMethod · 0.92
collectAttributesFunction · 0.92

Calls 4

SnakeCaseFunction · 0.85
LastMethod · 0.80
AttributeMethod · 0.65
NameMethod · 0.65

Tested by

no test coverage detected