forked from progrium/darwinkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtype.go
28 lines (23 loc) · 781 Bytes
/
type.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package typing
import (
"github.com/progrium/darwinkit/generate/modules"
"github.com/progrium/darwinkit/internal/set"
"github.com/progrium/darwinkit/internal/stringx"
)
// Type interface for all type
type Type interface {
// GoName Go type name
GoName(currentModule *modules.Module, receiveFromObjc bool) string
// ObjcName Objective-c type name
ObjcName() string
// GoImports go imports for this type
GoImports() set.Set[string]
// DeclareModule the module of this type. return nil if is a built in type
DeclareModule() *modules.Module
}
func FullGoName(module modules.Module, name string, currentModule modules.Module) string {
if module.Name == currentModule.Name {
return stringx.Capitalize(name)
}
return module.Package + "." + stringx.Capitalize(name)
}