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

Vastly improved API #232

Merged
merged 1 commit into from Feb 8, 2019
Merged

Vastly improved API #232

merged 1 commit into from Feb 8, 2019

Conversation

elliotchance
Copy link
Owner

@elliotchance elliotchance commented Feb 8, 2019

This is the biggest refactoring in a long time. This address several issues with the API that have been bothing me.

  1. All nodes were created with basically the same interface, that always required a document. Now constructors are much more simple for most of them that do not need a document. For the handful that still do, these can only be created from the document itself to prevent the need to pass the Document around separately.

  2. Since nodes that require an owner (such as a Document or Family) can only be created through these entities it will greatly improve strategies for caching where changed occur after the document is initially loaded. I haven't heavily jumped into this teritory, but it will have to happen soon.

  3. Families are now structures correctly with ChildNode, HusbandNode and WifeNode rather than trying to step around these. Apart from being closer to the GEDCOM structure this also make it easier to build families programamtically without awkwardly moving pointers around as values.

  4. Nodes is a new type for []Node.

Other more minor changes such as deleting nodes and correctly mapping documents when duplicating nodes.


This change is Reviewable

This is the biggest refactoring in a long time. This address several issues with the API that have been bothing me.

1. All nodes were created with basically the same interface, that always required a document. Now constructors are much more simple for most of them that do not need a document. For the handful that still do, these can only be created from the document itself to prevent the need to pass the Document around separately.

2. Since nodes that require an owner (such as a Document or Family) can only be created through these entities it will greatly improve strategies for caching where changed occur after the document is initially loaded. I haven't heavily jumped into this teritory, but it will have to happen soon.

3. Families are now structures correctly with ChildNode, HusbandNode and WifeNode rather than trying to step around these. Apart from being closer to the GEDCOM structure this also make it easier to build families programamtically without awkwardly moving pointers around as values.

4. Nodes is a new type for []Node.

Other more minor changes such as deleting nodes and correctly mapping documents when duplicating nodes.
@elliotchance elliotchance added this to In progress in gedcom via automation Feb 8, 2019
@codecov-io
Copy link

codecov-io commented Feb 8, 2019

Codecov Report

Merging #232 into master will increase coverage by 0.14%.
The diff coverage is 75.92%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #232      +/-   ##
=========================================
+ Coverage   63.26%   63.4%   +0.14%     
=========================================
  Files         175     182       +7     
  Lines        5629    5848     +219     
=========================================
+ Hits         3561    3708     +147     
- Misses       1960    2018      +58     
- Partials      108     122      +14
Impacted Files Coverage Δ
node.go 100% <ø> (ø) ⬆️
html/individual_events.go 0% <0%> (ø) ⬆️
html/partners_and_children.go 0% <0%> (ø) ⬆️
html/places.go 0% <0%> (ø) ⬆️
gedcom2text/main.go 0% <0%> (ø) ⬆️
html/individual_compare.go 53.27% <0%> (ø) ⬆️
html/family_in_list.go 0% <0%> (ø) ⬆️
html/parent_buttons.go 0% <0%> (ø) ⬆️
html/place_event.go 0% <0%> (ø) ⬆️
html/all_parent_buttons.go 0% <0%> (ø) ⬆️
... and 50 more

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 dcf25f4...99a1152. Read the comment docs.

@elliotchance elliotchance merged commit a89da1c into master Feb 8, 2019
gedcom automation moved this from In progress to Done Feb 8, 2019
@elliotchance elliotchance deleted the better-nodes branch February 8, 2019 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
gedcom
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants