Relations
Relations are defined as relation-type properties in type schemas. They let you connect objects with named links.
Defining Relations
Section titled “Defining Relations”name: bookproperties: - name: title type: string - name: author type: relation target: person bidirectional: true inverse: booksname: personproperties: - name: name type: string - name: books type: relation target: book multiple: true bidirectional: true inverse: authorRelation Fields
Section titled “Relation Fields”| Field | Description |
|---|---|
target | Target object’s type name |
multiple | Whether the property holds multiple values (array) |
bidirectional | Auto-sync the inverse side when linking |
inverse | Property name on the target type’s schema |
Using Relations
Section titled “Using Relations”Create a Link
Section titled “Create a Link”tmd link book/golang-in-action author person/alan-donovanWhen bidirectional: true, this automatically updates both the book’s author and the person’s books property.
Remove a Link
Section titled “Remove a Link”tmd unlink book/golang-in-action author person/alan-donovan --bothUse --both to remove the inverse side as well.