-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtransform.go
More file actions
66 lines (52 loc) · 1.32 KB
/
transform.go
File metadata and controls
66 lines (52 loc) · 1.32 KB
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
package toast
import "go/ast"
type Transform interface {
isTransform()
}
type ExcludeImport struct {
Match func(Import) bool
}
type ModifyImport struct {
Apply func(Import) Import
}
type ExcludeTypeDecl struct {
Match func(Type) bool
}
type ExcludeType struct {
Match func(Type) bool
}
type ModifyType struct {
Apply func(Type) Type
}
type ExcludeField struct {
Match func(*Field) bool
}
type ModifyField struct {
Apply func(*Field) *Field
}
type CopyIntoStruct struct {
StructName string
FieldToReplace string
FromStructs map[string]struct{}
with []*Field
}
type GenFieldTransform struct {
Generate func(*StructType, *Field) Transform
}
type GenEnumTypeTransform struct {
Generate func(string, *ast.ValueSpec) *PromoteToEnumType
}
type PromoteToEnumType struct {
Apply func(*PlainType) *EnumType
}
func (*ExcludeImport) isTransform() {}
func (*ModifyImport) isTransform() {}
func (*ExcludeTypeDecl) isTransform() {}
func (*ExcludeType) isTransform() {}
func (*ExcludeField) isTransform() {}
func (*CopyIntoStruct) isTransform() {}
func (*ModifyType) isTransform() {}
func (*ModifyField) isTransform() {}
func (*GenFieldTransform) isTransform() {}
func (*GenEnumTypeTransform) isTransform() {}
func (*PromoteToEnumType) isTransform() {}