Skip to content

Commit 21f0486

Browse files
authored
fix!: align package names & locations with Go recommendations (Resolves #101) (#102)
* fix!: align package names with Go recommendations (Resolves #101) * fix!: move packages to simplify imports (Resolves #101)
1 parent a94df0c commit 21f0486

28 files changed

+330
-323
lines changed

README.md

Lines changed: 63 additions & 63 deletions
Large diffs are not rendered by default.

external/epsearchast/v3/aliases.go renamed to aliases.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package epsearchast_v3
1+
package epsearchast
22

33
import "regexp"
44

external/epsearchast/v3/aliases_test.go renamed to aliases_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package epsearchast_v3
1+
package epsearchast
22

33
import (
44
"github.com/stretchr/testify/require"

external/epsearchast/v3/ast.go renamed to ast.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// Package epsearchast_v3 implements structs and functions for working with the EP-Internal-Search-AST-v3 header.
2-
package epsearchast_v3
1+
// Package epsearchast implements structs and functions for working with the EP-Internal-Search-AST-v3 header.
2+
package epsearchast
33

44
import (
55
"encoding/json"
@@ -102,7 +102,7 @@ func GetAst(jsonTxt string) (*AstNode, error) {
102102

103103
// The AstVisitor interface provides a way of specifying a [Visitor] for visiting an AST.
104104
//
105-
// This interface is clunky to use for conversions or when you need to return state, and you should use [epsearchast_v3.ReduceAst] instead.
105+
// This interface is clunky to use for conversions or when you need to return state, and you should use [epsearchast.ReduceAst] instead.
106106
// In particular because the return values are restricted to error, you need to manage and combine the state yourself, which can be more annoying than necessary.
107107
//
108108
// [Visitor]: https://en.wikipedia.org/wiki/Visitor_pattern

external/epsearchast/v3/ast_test.go renamed to ast_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package epsearchast_v3
1+
package epsearchast
22

33
import (
44
"github.com/stretchr/testify/require"

external/epsearchast/v3/ast_visitor_test.go renamed to ast_visitor_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package epsearchast_v3
1+
package epsearchast
22

33
import (
44
"fmt"

external/epsearchast/v3/errors.go renamed to errors.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package epsearchast_v3
1+
package epsearchast
22

33
import "fmt"
44

external/epsearchast/v3/es/es_query_builder.go renamed to es/es_query_builder.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
package epsearchast_v3_es
1+
package astes
22

33
import (
44
"fmt"
5-
epsearchast_v3 "github.com/elasticpath/epcc-search-ast-helper/external/epsearchast/v3"
65
"regexp"
76
"sort"
87
"strings"
8+
9+
"github.com/elasticpath/epcc-search-ast-helper"
910
)
1011

1112
type JsonObject map[string]any
@@ -150,7 +151,7 @@ func sortByDecreasingLength(groupKeys []string) {
150151
})
151152
}
152153

153-
var _ epsearchast_v3.SemanticReducer[JsonObject] = (*DefaultEsQueryBuilder)(nil)
154+
var _ epsearchast.SemanticReducer[JsonObject] = (*DefaultEsQueryBuilder)(nil)
154155

155156
func (d DefaultEsQueryBuilder) PostVisitAnd(rs []*JsonObject) (*JsonObject, error) {
156157
return &JsonObject{

external/epsearchast/v3/es/es_query_builder_int_test.go renamed to es/es_query_builder_int_test.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
package epsearchast_v3_es
1+
package astes
22

33
import (
44
"bytes"
55
"encoding/json"
66
"fmt"
7-
epsearchast_v3 "github.com/elasticpath/epcc-search-ast-helper/external/epsearchast/v3"
87
"io/ioutil"
98
"net/http"
109
"os"
1110
"testing"
11+
12+
"github.com/elasticpath/epcc-search-ast-helper"
1213
)
1314

1415
const esBaseURL = "http://localhost:20003"
@@ -24,7 +25,7 @@ type testStruct struct {
2425

2526
func (t *testStruct) String() string {
2627

27-
ast, err := epsearchast_v3.GetAst(t.filter)
28+
ast, err := epsearchast.GetAst(t.filter)
2829

2930
if err != nil {
3031
panic(fmt.Sprintf("Failed to get filter: %s)", err))
@@ -1048,12 +1049,12 @@ func TestSmokeTestElasticSearchWithFilters(t *testing.T) {
10481049
}
10491050

10501051
// Build Elasticsearch query
1051-
ast, err := epsearchast_v3.GetAst(tc.filter)
1052+
ast, err := epsearchast.GetAst(tc.filter)
10521053
if err != nil {
10531054
t.Fatalf("Failed to parse filter: %v", err)
10541055
}
10551056

1056-
var qb epsearchast_v3.SemanticReducer[JsonObject] = DefaultEsQueryBuilder{
1057+
var qb epsearchast.SemanticReducer[JsonObject] = DefaultEsQueryBuilder{
10571058
OpTypeToFieldNames: map[string]*OperatorTypeToMultiFieldName{
10581059
"key_value_field.description": {
10591060
Wildcard: "key_value_field.description.wildcard",
@@ -1082,7 +1083,7 @@ func TestSmokeTestElasticSearchWithFilters(t *testing.T) {
10821083
DefaultFuzziness: "AUTO",
10831084
}
10841085

1085-
query, err := epsearchast_v3.SemanticReduceAst(ast, qb)
1086+
query, err := epsearchast.SemanticReduceAst(ast, qb)
10861087
if err != nil {
10871088
t.Fatalf("Failed to reduce AST: %v", err)
10881089
}

0 commit comments

Comments
 (0)