In this article, we would be discussing implementing a stack in Golang.
It would be a continuation of my series of implementing Data Structures in Golang
What is Stack?
Stack is a simple data structure used for storing data. In a stack, the order in which the data arrives is of the most importance.
Stack is an ordered list in which insertion and deletion are done at the end, known as the top. The last element inserted in the stack is the first element to be deleted/removed first.
It is known as Last In First Out (LIFO).
In this article, we would be discussing the implementation of Queue(backed by Array/Slice) in Golang
This would be a follow-up to my recent article:
A queue is an abstract data structure (ADT) that follows a particular order in which the operations are performed.
It follows the First In First Out (LIFO) order for operations.
In a layman example, a queue is any queue of consumers for a resource where the consumer that came first is served first.
The difference between a queue and a stack is the removal order, in a stack, we remove the item…
If a reader with a basic understanding of Golang might know that it has data structures like array, slice, map.
But being accustomed to Java, I missed the support of the Collections framework, its simplicity in usage, and multiple options like HashMap, TreeMap, ConcurrentHashMap, etc. which we can use as per our requirements.
Thus it led me to the question of whether if we can implement the same Java Collections in Golang from a curiosity perspective.
I am starting with the first of such implementation with LinkedList.
Let’s start with our implementation.
A linked list is a linear data structure…
In this article, we would be building a GraphQL server to interact with our backend i.e. MySQL database.
Code related to the article will be attached at the end.
That’s the first question I had asked myself when my team had the requirement to expose GraphQL endpoints along with already existing RESTful APIs.
Upon some brainstorming (which is nothing but Google, StackOverflow articles) we reached our conclusion.
GraphQL is a query language for APIs and a runtime for fulfilling those queries with your existing data. GraphQL provides a complete and understandable description of the data in your API, gives clients…
Article focuses on developing a basic RESTful CRUD API’s using Golang & MySql as backend database.
Github link related to the article has been attached in the end.
We would be developing an application that exposes a basic REST-API server for CRUD operations for managing Persons (id,firstName,lastName, age)
Before we start, lets us make a check that the reader might have basic knowledge of SQL and Golang.
In case of learning more about Golang, would suggest going through Go By Example
So let’s dive in!!
Setting up the application
Let’s start with creating our root folder
mkdir rest-go-demo &&…
Learning a new thing at a time, Senior Developer at Connectwise