Object relation mapping with GORM

What is object-relation mapping (ORM, O/RM, and O/R mapping)? Object-relational mapping in computer science is a programming technique for converting data between incompatible type systems in object-oriented programming languages. This creates, in effect, a “virtual object database” that can be used from within the programming language. source: Wikipedia What is GORM? GORM is object-relation package for Go. It supports the following databases: FoundationDB PostgreSQL MySQL SQLite Installation It is easy to install by invoking go get command:...

November 15, 2015 · 5 min · Svetlin Ralchev

Embedded resources in Golang

What’s an Embedded Resource? An embedded resource in a application is a file that is included as part of the application. The file is not compiled, but is accessable from the code at run-time. Embedded resources can be any file type. Languages as JAVA and C# support resources out of box. However, this is not the case for Golang. In order to emebed resource, we need to develop our own solution....

November 8, 2015 · 5 min · Svetlin Ralchev

Develop code generation tool for Golang

In my previous blog post, we discussed one of my favourite code generation tools for Go. We found that they can be used to automate our trivial development tasks or even introduce features like generics and queries. Lets explore how to create our own tool. Introduction The Go generate subcommand is a program that scans for special comments in your Go source code. The comment declares a command that should be executed....

October 31, 2015 · 4 min · Svetlin Ralchev

Query data with Golang and LINQ

Query langauges provide a set of features to querying, projecting and retrieving data (usually relational data). But how to introduces these standard, easily-learned patterns for querying data? In this article we will explore Go LINQ packages that bridges the gap between the world of objects and the world of data. LINQ For first time is introduced by Microsoft in their programming language C#. Its purpose is to bridge the gap between query languages such as SQL and programming languages....

October 25, 2015 · 5 min · Svetlin Ralchev

Generics in Golang

In the article we will take the advantage of [generics] even that they are not first citizen in Go. We will explore gen and genny command line tools. Gen Gen is a code generation tool that brings some generic query functions. It uses annotations to add this functionality to any structure. The generated code is part of your package and does not have any external dependencies. This approach avoids any reflection and produces an efficient concrete implementation for any annotated type....

October 18, 2015 · 8 min · Svetlin Ralchev