WEEK 9: ENTRY 3

At my internship today, I continued on completing the merging and outputting the final result on my server. Yesterday I was able to successfully compare the hostnames from the Elasticsearch API and Big Query API in the form of struct; however, I could not combine the two struct and transform the struct data type into a readable format, for instance Json. As a result, I spent my whole today resolving that issue. In simple terms, I have these two structs that I needed to merge after making the comparison and display the one merge data on my browser. To make sure the comparison I was making from yesterday was correct, I loop through the merge data and create a map. Maps are great choices because of its keys and values; however, it was not the best choice because my server is to display the final output into a json format and apparently using a struct makes that way more dynamic and easier. With a struct, I could easily convert the struct into a json format by unmarshalling it. 


Although I have been working with structs for a while now, it was a different approach I needed because after the comparison I needed to append the hostnames and their metadata to a data structure, which could be an array, map, or struct. In my case, the struct was the best option. I could easily append the data to the map but I was little did I know that I can do the same with the struct. All this while I have been having the answer beneath my eyes, but as the saying goes, “Ignorance is bliss.”  I felt so dumbed when my buddy helped me to append the data to the struct because it was the simplest part of all this implementation. In another way, I felt that it was because I just did not know, so it was not as bad as it should have been when I knew. 


Generally, I gained the understanding of how versatile Go structs are as well as how easy resolving an issue is when you understand what data structures best suits your use case. Another insight I gained was that I could always explore various options while troubleshooting an issue to narrow down the wide range of failure percentage. As a result, I intend to keep working harder on my data structures and Go skills so that next time I encounter a similar issue, it would be made easier.


Comments

Popular posts from this blog

WEEK 4: ENTRY 3

WEEK 6: ENTRY 3

WEEK 7: ENTRY 1