-
Notifications
You must be signed in to change notification settings - Fork 1
/
model.go
44 lines (35 loc) · 1.02 KB
/
model.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
package semantic
import (
"github.com/darklab8/fl-configs/configs/configs_mapped/parserutils/filefind/file"
"github.com/darklab8/fl-configs/configs/configs_mapped/parserutils/inireader"
"github.com/darklab8/go-utils/goutils/utils/utils_types"
)
type Model struct {
section *inireader.Section
}
func (s *Model) Map(section *inireader.Section) {
s.section = section
}
func (s *Model) RenderModel() *inireader.Section {
return s.section
}
type ConfigModel struct {
sections []*inireader.Section
comments []string
filepath utils_types.FilePath
}
func (s *ConfigModel) Init(sections []*inireader.Section, comments []string, filepath utils_types.FilePath) {
s.sections = sections
s.comments = comments
s.filepath = filepath
}
func (s *ConfigModel) SetOutputPath(filepath utils_types.FilePath) {
s.filepath = filepath
}
func (s *ConfigModel) Render() *inireader.INIFile {
inifile := &inireader.INIFile{}
inifile.Comments = s.comments
inifile.Sections = s.sections
inifile.File = file.NewFile(s.filepath)
return inifile
}