Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added path support #20

Merged
merged 3 commits into from
Nov 4, 2019
Merged

added path support #20

merged 3 commits into from
Nov 4, 2019

Conversation

DvirDukhan
Copy link
Contributor

No description provided.

@codecov
Copy link

codecov bot commented Nov 3, 2019

Codecov Report

Merging #20 into master will decrease coverage by 0.17%.
The diff coverage is 61.7%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #20      +/-   ##
==========================================
- Coverage   67.75%   67.57%   -0.18%     
==========================================
  Files           6        7       +1     
  Lines         428      475      +47     
==========================================
+ Hits          290      321      +31     
- Misses        124      140      +16     
  Partials       14       14
Impacted Files Coverage Δ
query_result.go 74.86% <100%> (+2.08%) ⬆️
path.go 55% <55%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1b74aa6...10be6f2. Read the comment docs.

Copy link
Contributor

@swilly22 swilly22 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!

path.go Outdated
Comment on lines 9 to 10
Nodes []interface{}
Edges []interface{}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nodes []Node
Edges []Edge

we've got both an Edge and Node structs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed to []*Node and []*Edge

Edges []interface{}
}

func PathNew(nodes []interface{}, edges []interface{}) Path {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

func PathNew(nodes []Node, edges []Edge) Path {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the constructor will convert from array of interface to array of node/edge

path.go Outdated
}
}

func (p Path) GetNodes() []interface{} {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

func (p Path) GetNodes() []Node {

path.go Outdated
return p.Nodes
}

func (p Path) GetEdges() []interface{} {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

func (p Path) GetEdges() []Edge {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[]*Edge

}

func (p Path) FirstNode() *Node {
return p.GetNode(0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if the Path is empty?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

execption

path.go Outdated
}

func (p Path) GetNode(index int) *Node {
return p.Nodes[index].(*Node)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Index validations?
index >=0 && index < Path length ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exception

}

func (p Path) LastNode() *Node {
return p.GetNode(p.NodesCount() - 1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if NodeCount is 0?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exception

path.go Outdated
return len(p.Edges)
}

func (p Path) Encode() string {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://play.golang.org/p/Azql7_pDAA
func (p Path) String() string {...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

README.md Outdated
res.Next()
r := res.Record()
p, ok := r.GetByIndex(0).(Path)
fmt.Printf("%v", p.Encode())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fmt.Printf("%s", p)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

arrays := cell.([]interface{})
nodes := qr.parseScalar(arrays[0].([]interface{}))
edges := qr.parseScalar(arrays[1].([]interface{}))
return PathNew(nodes.([]interface{}), edges.([]interface{}))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return PathNew(nodes, edges)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be an array

@swilly22 swilly22 merged commit d368e34 into master Nov 4, 2019
@swilly22 swilly22 deleted the path_type branch November 4, 2019 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants