Putting it all together

The last thing we need to do is update the rest of the code to work with the changes we've made so far.

First of all, we need to update the Article type to add the extra url field. We need it in the list of fields and in the two constructors. Here is the final version of Articles.jl:

module Articles 
 
export Article, save, find 
 
using ...Database, MySQL, JSON 
 
struct Article 
  content::String 
  links::Vector{String} 
  title::String 
  image::String 
  url::String 
 
  Article(; content = "", links = String[], title = "", image = "", url = "") =  new(content, links, title, image, url) Article(content, links, title, image, url) = new(content, links, title, image, url) end function find(url) :: Vector{Article} articles = Article[] result ...

Get Julia Programming Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.