diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index c55ccfc..0a20438 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -54,17 +54,17 @@ jobs: - name: Run Unit Tests run: go test ./... -cover -short -# - name: Start Neo4j V3 Docker -# run: | -# docker-compose -f .github/docker-compose-v3.yaml up -d -# - name: Wait for neo4j v3 to be ready -# run: | -# sleep 45 -# - name: Run Integration Test on V3 -# run: go test ./... -cover -run Integration -# - name: Stop Neo4j Docker on v3 -# run: | -# docker-compose -f .github/docker-compose-v3.yaml down --remove-orphans + - name: Start Neo4j V3 Docker + run: | + docker-compose -f .github/docker-compose-v3.yaml up -d + - name: Wait for neo4j v3 to be ready + run: | + sleep 45 + - name: Run Integration Test on V3 + run: go test ./... -cover -run Integration + - name: Stop Neo4j Docker on v3 + run: | + docker-compose -f .github/docker-compose-v3.yaml down --remove-orphans - name: Start Neo4j V4 Docker run: | diff --git a/interfacev2.go b/interfacev2.go index 549e12d..f972ce9 100644 --- a/interfacev2.go +++ b/interfacev2.go @@ -55,16 +55,16 @@ type TransactionV2 interface { type ogmFunctions interface { //load single object - Load(ctx context.Context, respObj , id interface{},) error + Load(ctx context.Context, respObj, id interface{}) error //load object with depth - LoadDepth(ctx context.Context, respObj , id interface{}, depth int) error + LoadDepth(ctx context.Context, respObj, id interface{}, depth int) error //load with depth and filter - LoadDepthFilter(ctx context.Context,respObj , id interface{}, depth int, filter *dsl.ConditionBuilder, params map[string]interface{}) error + LoadDepthFilter(ctx context.Context, respObj, id interface{}, depth int, filter *dsl.ConditionBuilder, params map[string]interface{}) error //load with depth, filter and pagination - LoadDepthFilterPagination(ctx context.Context, respObj , id interface{}, depth int, filter dsl.ConditionOperator, params map[string]interface{}, pagination *Pagination) error + LoadDepthFilterPagination(ctx context.Context, respObj, id interface{}, depth int, filter dsl.ConditionOperator, params map[string]interface{}, pagination *Pagination) error //load slice of something LoadAll(ctx context.Context, respObj interface{}) error diff --git a/load_strategy.go b/load_strategy.go index 474da90..74176e4 100644 --- a/load_strategy.go +++ b/load_strategy.go @@ -109,7 +109,7 @@ func PathLoadStrategyOne(variable, label, fieldOn, paramName string, isGraphId b Name: variable, Field: fieldOn, ConditionOperator: dsl.EqualToOperator, - Check: dsl.ParamString("$" + paramName) , + Check: dsl.ParamString("$" + paramName), } } diff --git a/save.go b/save.go index 2c9a15c..d436faa 100644 --- a/save.go +++ b/save.go @@ -245,9 +245,9 @@ func relateNodes(transaction neo4j.Transaction, relations map[string][]*relCreat "rows": params, }) if err != nil { - return err + return fmt.Errorf("failed to relate nodes, %w", err) } else if err = res.Err(); err != nil { - return err + return fmt.Errorf("failed to relate nodes %w", res.Err()) } } @@ -279,7 +279,7 @@ func removeRelations(transaction neo4j.Transaction, dels map[int64][]int64) erro }).V(dsl.V{ Name: "end", }).Build()). - Cypher("WHERE id(start) in row.startNodeId and id(end) IN row.endNodeIds"). + Cypher("WHERE id(start) = row.startNodeId and id(end) = row.endNodeIds"). Delete(false, "e"). ToCypher() if err != nil { @@ -563,7 +563,7 @@ func createNodes(transaction neo4j.Transaction, crNodes map[string]map[uintptr]* cyp, err := dsl.QB(). Cypher("UNWIND $rows as row"). Cypher(fmt.Sprintf("MATCH %s", path)). - Cypher("WHERE ID(n) in row.id"). + Cypher("WHERE ID(n) = row.id"). Cypher("SET n += row.obj"). ToCypher() diff --git a/sessionv2.go b/sessionv2.go index 3855acc..7ff6247 100644 --- a/sessionv2.go +++ b/sessionv2.go @@ -175,7 +175,7 @@ func (s *SessionV2Impl) Commit(ctx context.Context) error { return nil } -func (s *SessionV2Impl) Load(ctx context.Context, respObj , id interface{}) error { +func (s *SessionV2Impl) Load(ctx context.Context, respObj, id interface{}) error { var span opentracing.Span if ctx != nil && s.gogm.config.OpentracingEnabled { span, ctx = opentracing.StartSpanFromContext(ctx, "gogm.SessionV2Impl.Load") @@ -187,7 +187,7 @@ func (s *SessionV2Impl) Load(ctx context.Context, respObj , id interface{}) erro return s.LoadDepthFilterPagination(ctx, respObj, id, s.DefaultDepth, nil, nil, nil) } -func (s *SessionV2Impl) LoadDepth(ctx context.Context, respObj , id interface{}, depth int) error { +func (s *SessionV2Impl) LoadDepth(ctx context.Context, respObj, id interface{}, depth int) error { var span opentracing.Span if ctx != nil && s.gogm.config.OpentracingEnabled { span, ctx = opentracing.StartSpanFromContext(ctx, "gogm.SessionV2Impl.LoadDepth") @@ -199,7 +199,7 @@ func (s *SessionV2Impl) LoadDepth(ctx context.Context, respObj , id interface{}, return s.LoadDepthFilterPagination(ctx, respObj, id, depth, nil, nil, nil) } -func (s *SessionV2Impl) LoadDepthFilter(ctx context.Context, respObj , id interface{}, depth int, filter *dsl.ConditionBuilder, params map[string]interface{}) error { +func (s *SessionV2Impl) LoadDepthFilter(ctx context.Context, respObj, id interface{}, depth int, filter *dsl.ConditionBuilder, params map[string]interface{}) error { var span opentracing.Span if ctx != nil && s.gogm.config.OpentracingEnabled { span, ctx = opentracing.StartSpanFromContext(ctx, "gogm.SessionV2Impl.LoadDepthFilter") @@ -211,7 +211,7 @@ func (s *SessionV2Impl) LoadDepthFilter(ctx context.Context, respObj , id interf return s.LoadDepthFilterPagination(ctx, respObj, id, depth, filter, params, nil) } -func (s *SessionV2Impl) LoadDepthFilterPagination(ctx context.Context, respObj , id interface{}, depth int, filter dsl.ConditionOperator, params map[string]interface{}, pagination *Pagination) error { +func (s *SessionV2Impl) LoadDepthFilterPagination(ctx context.Context, respObj, id interface{}, depth int, filter dsl.ConditionOperator, params map[string]interface{}, pagination *Pagination) error { var span opentracing.Span if ctx != nil && s.gogm.config.OpentracingEnabled { span, ctx = opentracing.StartSpanFromContext(ctx, "gogm.SessionV2Impl.LoadDepthFilterPagination")