Skip to content

Commit 3cc8244

Browse files
committed
linkedql: refactor to avoid embedding unexported interfaces and named returns
1 parent a6178e7 commit 3cc8244

1 file changed

Lines changed: 15 additions & 11 deletions

File tree

query/linkedql/property_path.go

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ type propertyPathI interface {
1414

1515
// PropertyPath is an interface to be used where a path of properties is expected.
1616
type PropertyPath struct {
17-
propertyPathI
17+
p propertyPathI
1818
}
1919

2020
// Type implements Step
@@ -27,39 +27,43 @@ func (*PropertyPath) Description() string {
2727
return "PropertyPath is a string, multiple strins or path describing a set of properties"
2828
}
2929

30+
func (p *PropertyPath) BuildPath(qs graph.QuadStore) (*path.Path, error) {
31+
return p.p.BuildPath(qs)
32+
}
33+
3034
// UnmarshalJSON implements RawMessage
31-
func (p *PropertyPath) UnmarshalJSON(data []byte) (err error) {
35+
func (p *PropertyPath) UnmarshalJSON(data []byte) error {
3236
var errors []error
3337

3438
var propertyIRIs PropertyIRIs
35-
err = json.Unmarshal(data, &propertyIRIs)
39+
err := json.Unmarshal(data, &propertyIRIs)
3640
if err == nil {
37-
p.propertyPathI = propertyIRIs
38-
return
41+
p.p = propertyIRIs
42+
return nil
3943
}
4044
errors = append(errors, err)
4145

4246
var propertyIRIStrings PropertyIRIStrings
4347
err = json.Unmarshal(data, &propertyIRIStrings)
4448
if err == nil {
45-
p.propertyPathI = propertyIRIStrings
46-
return
49+
p.p = propertyIRIStrings
50+
return nil
4751
}
4852
errors = append(errors, err)
4953

5054
var propertyIRI PropertyIRI
5155
err = json.Unmarshal(data, &propertyIRI)
5256
if err == nil {
53-
p.propertyPathI = propertyIRI
54-
return
57+
p.p = propertyIRI
58+
return nil
5559
}
5660
errors = append(errors, err)
5761

5862
var propertyIRIString PropertyIRIString
5963
err = json.Unmarshal(data, &propertyIRIString)
6064
if err == nil {
61-
p.propertyPathI = propertyIRIString
62-
return
65+
p.p = propertyIRIString
66+
return nil
6367
}
6468
errors = append(errors, err)
6569

0 commit comments

Comments
 (0)