OAuth 2.0 Server & Authorization Middleware for Gin-Gonic

Project OAuthOAuth is an open source project developed in Go and available on GitHub. The project offers an Authorization Server and an Authorization Middleware that can be used to make secure access to resources API and provide a simple and efficient implementation of the OAuth 2.0 specification.
Authorization Server and Middleware are both based on Gin-Gonic and can interoperate with any other middleware available for this framework. 

Authorization ServerThe Authorization Server is implemented by the struct OAuthBearerServer that manages two grant types of authorizations: password and client_credentials. This Authorization Server is made to provide authorization token usable for consuming resources API. Developers need only add their own implementation of CredentialsVerifier interface to validate the credentials of users or applications that require a token.

package main

import (

Data Model Generation for PostgreSQL

DinGo is a simple Go code generator that is useful to produce Microservice applications starting from the database schema.

PostgreSQL supportedAs I showed in the previous post DinGo produces code reading the database schema and its first version supported only the MySQL database, but now after a not so short and unfortunately not continuous work, finally the PostgreSQL database has been supported.

The current release (2.0.beta) contains all the templates and producers for providing microservices that can operate on Postgres. This DinGo release is still in beta because it requires a few tests and there are also some limitations. Postgres array types are not supported and I don't know if they will be in the future.

Reading the Information SchemaPostgreSQL offers two methods for retrieving meta-data about the table's schema using the system catalogs (pg_class, pg_user, pg_view, ...) or querying the information_schema (available since Postgres 7.4).
DinGo has adopted the second met…

From the database schema to RESTful API with DinGo

In the previous post I had started writing about data model and code generation and the post coincided with the boot of an open source project called DinGo thought to generate the Go code for a Microservice host analysing the schema of a relational database.

It's a very SQL First approach to write code, so I don't think it should be good for all the projects, but surely there are many applications that can take advantage from this, at least those are using already defined relational databases and want to adopt a Microservice architecture and RESTful API.

What DinGo does DinGo creates a Microservice application starting from a MySQL database schema. Dingo follows these steps during the generation process:
DinGo reads the information_schema of the MySQL databaseit generates a set of Data Model structs used to map tables into Go structsit generates the Data Access Objects, these objects provide a set of basic operations (CRUD operations) necessary to manipulate entitiesit generates …

Data Model Code Generation

Don't repeat yourselfOften developing applications we find ourselves writing the same code more than once and often this code regards access to data. If the data are stored on the relational database we need to implement the functions that perform the operations of create, read, update and delete (CRUD) and some other utility functions to retrieve a entity by primary key, count the entities in the table and etc.
We can write the same code for each entity or we can write the code generator that will implement it for us. For this reason code generators can be useful to produce the repetitive code that we should implement by hand, thus eliminating the tedious part of writing code.

Querying MySQL Information_SchemaIn order to generate the code that accesses the entities we need to know the structure of these entities.
If the data are stored on the MySQL database we can query the "Information Schema" to know the database structure. Information_schema contains a set of views that…

OVO Key/Value Storage

Yet another Key/Value Storage ?I started developing OVO, my own implementation of a Key/Value Storage, six month ago because I wanted to testdeveloping a projectusingtheGo language. In the past, I had alreadyworkedon a similar project, GetCache, but it is developedwith.Net framework.

I don't thinkthatthe worldlackstheKey/ValueStorage, butfor meitis treatedtoa great gymtotrain myGo. I have realized that this project with the Go language is extraordinarily simple and so I would like to share this experience.

What is OVOInitially, the projectaimed tocreatea distributed cache, likeMemcached, that would allow to store objects andJSONstructures quicklyby spreading the loadacross multiple servers, and