Debian Codegraph @

configupgrade/proxyhelper.go

raw
1 // Copyright (c) 2024 Tulir Asokan
2 //
3 // This Source Code Form is subject to the terms of the Mozilla Public
4 // License, v. 2.0. If a copy of the MPL was not distributed with this
5 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7 package configupgrade
8
9 type ProxyHelper struct {
10 Prefix []string
11 Target Helper
12 }
13
14 var _ Helper = (*ProxyHelper)(nil)
15
16 func (p *ProxyHelper) Copy(allowedTypes YAMLType, path ...string) {
17 p.Target.Copy(allowedTypes, append(p.Prefix, path...)...)
18 }
19
20 func (p *ProxyHelper) Get(tag YAMLType, path ...string) (string, bool) {
21 return p.Target.Get(tag, append(p.Prefix, path...)...)
22 }
23
24 func (p *ProxyHelper) GetBase(path ...string) string {
25 return p.Target.GetBase(append(p.Prefix, path...)...)
26 }
27
28 func (p *ProxyHelper) GetNode(path ...string) *YAMLNode {
29 return p.Target.GetNode(append(p.Prefix, path...)...)
30 }
31
32 func (p *ProxyHelper) GetBaseNode(path ...string) *YAMLNode {
33 return p.Target.GetBaseNode(append(p.Prefix, path...)...)
34 }
35
36 func (p *ProxyHelper) Set(tag YAMLType, value string, path ...string) {
37 p.Target.Set(tag, value, append(p.Prefix, path...)...)
38 }
39
40 func (p *ProxyHelper) SetMap(value YAMLMap, path ...string) {
41 p.Target.SetMap(value, append(p.Prefix, path...)...)
42 }
43
44 func (p *ProxyHelper) AddSpaceBeforeComment(path ...string) {
45 p.Target.AddSpaceBeforeComment(append(p.Prefix, path...)...)
46 }