January 2020
Intermediate to advanced
640 pages
16h 56m
English
Since there is no upper bound in the number of links or edges that can be potentially returned by calls to the Links and Edges methods, we will be implementing the iterator design pattern and lazily fetch Link and Edge models on demand. The LinkIterator and EdgeIterator types, which are returned by these methods, are interfaces themselves. This is intentional as their internal implementation details will obviously depend on the database technology that we select for the link graph persistence layer. Here is how they are defined:
// LinkIterator is implemented by objects that can iterate the graph links. type LinkIterator interface { Iterator // Link returns the currently fetched link object. Link() *Link } // EdgeIterator ...