/
types.go
85 lines (73 loc) · 1.63 KB
/
types.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
/*
* Copyright (c) 2023-present unTill Pro, Ltd.
* @author Alisher Nurmanov
*/
package main
type vpmParams struct {
Dir string
TargetDir string
IgnoreFile string
HeaderFile string
PackagePath string
}
// packageFiles is a map of package name to a list of files that belong to the package
type packageFiles map[string][]string
// baselineInfo is a struct that is saved to baseline.json file
type baselineInfo struct {
BaselinePackageUrl string
Timestamp string
GitCommitHash string `json:",omitempty"`
}
type ignoreInfo struct {
Ignore []string `yaml:"Ignore"`
}
// types for ORM generating
type ormPackageInfo struct {
Name string
FullPath string
HeaderFileContent string
}
type ormPackage struct {
ormPackageInfo
Items []interface{}
}
type ormPackageItem struct {
Package ormPackageInfo
QName string
TypeQName string
Name string
Type string
// TODO: find a way to extract sql-code of the package item from parser/appdef
SqlContent string
}
type ormTableItem struct {
ormPackageItem
Fields []ormField
Keys []ormField
NonKeyFields []ormField
}
type ormCommand struct {
ormPackageItem
ArgumentObject interface{}
UnloggedArgumentObject interface{}
ResultObjectFields []ormField
}
func getQName(obj interface{}) string {
switch t := obj.(type) {
case ormPackageItem:
return t.QName
case ormTableItem:
return t.QName
case ormCommand:
return t.QName
default:
panic("unknown type")
}
}
type ormField struct {
Table ormTableItem
Type string
Name string
GetMethodName string
SetMethodName string
}