Go: ent, Graph-Based ORM by Facebook

Vincent
A Journey With Go
Published in
5 min readOct 9, 2019

--

Illustration created for “A Journey With Go”, made from the original Go Gopher, created by Renee French.

ℹ️ This article is based on the master branch of the project still in development.

ent is an ORM created by the team Facebook Connectivity. Motivated by the lack of tools able to query data as a graph in the Go community, as well as a lack of 100% type-safety ORM, ent has been designed to address those issues.

Graph concept

ent represents the concept of graphs by a list of entities and edges without any limit in the representation. Let’s use the example available in the repository:

data represented with graph

In this example, there are three entities, Group, User, Pet, linked all together that can be traversed multiple ways. This diagram can be described by the tool entc provided with the project thanks to the command entc describe:

The relations between the entities are described by edges that are translated internally to fields, tables, and foreign keys. Here is the generated database diagram in MySQL:

--

--