Post

Visualizzazione dei post da 2016

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 supported As 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 Schema PostgreSQL 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). Din...

From the database schema to RESTful API with DinGo

Immagine
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 database it generates a set of Data Model structs used to map tables into Go structs it generates the Data Access Objects , these objects provide a set of basic operations (CRUD operatio...

Data Model Code Generation

Don't repeat yourself Often 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_Schema In 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 co...

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 test developing a project using the Go language. In the past , I had already worked on a similar project , GetCache , but it is developed with .Net framework . I don't think that the world lacks the Key / Value Storage , but for me it is treated to a great gym to train my Go . I have r ealized that this project with the Go language is extraordinarily simple and so I would like to share this experience. What is OVO Initially, the project aimed to create a distributed cache , like Memcached , that would allow to store  objects  and   JSON   structures  quickly by spreading the load across multiple servers , and could run on any kind of Linux , Windows , iOS machine . Each cached object can have a time-to-live property ( TTL) set so that the removal is done automaticall...