When testing our applications we often have a lot of external dependencies, and often we’re not running our tests in an environment where we have room to boot up Redis, MySQL etc.
Recently I was trying to solve the problem of needing a Redis connection in one of my applications…
So unlike modern PHP, Go handles the way we interact with types in our applications in a different way, through the use of structs. In fact it tailors itself to be more primitive, like it’s grandfather C.
Go does however have similar concepts implemented, which to an outsiders point of…
For all you beginner, intermediate or expert PHP developers, here’s an article which should provide you with a little guidance on how to get started writing your applications in Golang and how it compares to a similar workflow with PHP.
Developing Go applications can often be a slog, especially if you’re the Go application is a service in a larger ecosystem, that you need to run locally during development.
Every time we make a change to our code we’d have to kill our Docker container, re-build our Go binary and…
2017 has been an interesting year for me, I feel like I’ve learned so much about myself, my skills and the industry which is “Web Applications”. …
Have you ever wondered how you can interact with a database in Go using the Model pattern? Well here’s a quick example of how you can get started with GORM, an ORM for Go.
In this example we connect to an SQLite database called
database.db and migrate a new table for users. We then add a new user row with the name “Craig” and fetch all users. We finish by printing out the JSON representation of this list of users.
GORM makes interacting with databases in Go dead simple and is just one of the many tools you can use to encapsulate your data layer in the Model architecture.
Check it out here.
Before running this, please ensure the environment you’re running this on has SQLite and that you’ve run the following
go get commands:
go get github.com/jinzhu/gorm &
go get github.com/jinzhu/gorm/dialects/sqlite
To start, I’m sat in a coffee shop, 72 miles from my flat and I’m working. Crazy, I know. Technically right at this moment I’m writing this article, shhhhhh.
I always thought when the time came for me to plunge into full-time work, my working day would go something like…
Recently I’ve been implementing a small side project in Go with Gin. I know how easy it is to setup tests with Go, but I was very surprised not many people had covered examples of how to test the JSON responses for your APIs. With Gin specifically.
I discovered, it’s…
I’m going to assume you’ve got Go and Docker installed locally, if you haven’t then head on over to these links and head back here once you’re done :)
So first we’ll create our
Dockerfile ready to run our compiled web server, called
FROM scratchADD main…
I've always been intrigued by the way people work, what editors they use, any cool workflow apps, which version control system they're using and why? So I thought I'd share the way I do things.
These are my opinions; Some of you may find them useful, some might agree and…