As mentioned in the introduction section, running
ent on the schemas,
will generate the following assets:
Txobjects used for interacting with the graph.
- CRUD builders for each schema type. See CRUD for more info.
- Entity object (Go struct) for each of the schema type.
- Package containing constants and predicates used for interacting with the builders.
migratepackage for SQL dialects. See Migration for more info.
Gremlin (AWS Neptune)
Save a user.
SaveX a pet; Unlike Save, SaveX panics if an error occurs.
Save a bulk of pets.
Update an entity that was returned from the database.
Filter using predicates.
Get all users with followers.
Get all followers of a specific user; Start the traversal from a node in the graph.
Get all pets of the followers of a user.
More advance traversals can be found in the next section.
Get all pet names.
Select partial objects and partial associations.gs
Get all pets and their owners, but select and fill only the
Scan all pet names and ages to custom struct.
Update an entity and return a partial of it.
Delete an entity.
Delete by ID.
Delete using predicates.
Each generated node type has its own type of mutation. For example, all
User builders, share
the same generated
However, all builder types implement the generic
For example, in order to write a generic code that apply a set of methods on both
ent.UserUpdate, use the
In some cases, you want to apply a set of methods on multiple types.
For cases like this, either use the generic
or create your own interface.