-
Notifications
You must be signed in to change notification settings - Fork 255
/
resource_metadata.go
40 lines (37 loc) · 1.32 KB
/
resource_metadata.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
package modconfig
// ResourceMetadata ius a struct containing additional data
// about each resource, used to populate the introspection tables
type ResourceMetadata struct {
ResourceName string `column:"resource_name,text"`
// mod short name
ModName string `column:"mod_name,text"`
FileName string `column:"file_name,text"`
StartLineNumber int `column:"start_line_number,integer"`
EndLineNumber int `column:"end_line_number,integer"`
IsAutoGenerated bool `column:"auto_generated,bool"`
SourceDefinition string `column:"source_definition,text"`
ModFullName string
Anonymous bool `column:"is_anonymous,bool"`
}
// SetMod sets the mod name and mod short name
func (m *ResourceMetadata) SetMod(mod *Mod) {
// if the mod is the auto-generated default workspace mod, do not save in metadata
if mod.IsDefaultMod() {
return
}
m.ModName = mod.ShortName
m.ModFullName = mod.FullName
}
func (m *ResourceMetadata) Clone() *ResourceMetadata {
return &ResourceMetadata{
ResourceName: m.ResourceName,
ModName: m.ModName,
FileName: m.FileName,
StartLineNumber: m.StartLineNumber,
EndLineNumber: m.EndLineNumber,
IsAutoGenerated: m.IsAutoGenerated,
SourceDefinition: m.SourceDefinition,
ModFullName: m.ModFullName,
Anonymous: m.Anonymous,
}
}