-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathentity.go
99 lines (84 loc) · 1.64 KB
/
entity.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
package goruda
import (
"strings"
"time"
)
type DomainData struct {
StructName string
TimeStamp time.Time
Attributes []Attribute
Imports map[string]Import
Packagename string
IsPolymorph bool
SliceData SliceData
}
type SliceData struct {
Type string
}
type Import struct {
Alias string
Path string
}
type Attribute struct {
Name string
Type string
IsRequired bool
}
func (a Attribute) IsInteger() bool {
if strings.Contains(strings.ToLower(a.Type), "interface") {
return false
}
if strings.Contains(strings.ToLower(a.Type), "int") {
return true
}
return false
}
func (a Attribute) GetBitNumber() string {
if strings.Contains(a.Type, "32") {
return "32"
} else if strings.Contains(a.Type, "32") {
return "64"
}
return ""
}
func (a Attribute) IsFloat() bool {
if strings.Contains(strings.ToLower(a.Type), "float") {
return true
}
return false
}
func (a Attribute) IsCustomType() bool {
switch a.Type {
case "string", "int", "int32", "int64", "float", "float32", "float64", "interface{}", "map[string]interface{}":
return false
}
return true
}
type ListOfAttributes struct {
Attributes Attributes
ReturnValue Attributes
}
type Attributes []Attribute
func (a Attributes) GetLastIndex() int {
if len(a) < 1 {
return 0
}
return len(a) - 1
}
type AbstractionData struct {
TimeStamp time.Time
PackageName string
Name string
Methods map[string]ListOfAttributes
}
type HTTPMethods struct {
Path string
MethodsName string
Data ListOfAttributes
}
type HTTPData struct {
TimeStamp time.Time
PackageName string
ServiceName string
Methods map[string]HTTPMethods
}