December 2018
Beginner to intermediate
500 pages
12h 10m
English
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 ...Read now
Unlock full access