#Function
3 articles
12 Creating Dependecy Injection Library Google Wire
This time we will try to make Dependency Injection using the Wire Library from github.com/google/wire. The usefulness of this library is that we can make so many dependencies that we can generate directly concisely and easily.
11 Add Unit Tests Using Mockery
At this stage we will need the following dependencies
brew install mockery
go get github.com/stretchr/testify
go mod tidy
go mod vendor
go get github.com/DATA-DOG/go-sqlmock
In this project we will try to create unit tests using a mocking library with the name mockery
. This library is widely used by golang developers because of its ease of use and has the advantage of features that can cover all the necessary unit tests. If you have used unit tests in golang, you may already know this library but if you want to get more references, Santekno has also provided previous posts including:
13 How to Understanding HTML Template Function in Golang
Introduction to Function Templates
Apart from accessing fields
in templates, we can also access functions or functions
in Golang. The way to access a function is the same as accessing a field
, but if the function has parameters then we can use additional parameters that are sent when calling the function in the template.