schema/edge: add support for configuring foreign-key symbols

Fixed #1423
This commit is contained in:
Ariel Mashraki
2021-04-04 14:42:21 +03:00
committed by Ariel Mashraki
parent 745afde770
commit f3f03e1edd
8 changed files with 79 additions and 14 deletions

View File

@@ -86,13 +86,13 @@ func TestEdge(t *testing.T) {
from = edge.To("following", User.Type).
StructTag("following").
StorageKey(edge.Table("user_followers"), edge.Columns("following_id", "followers_id")).
StorageKey(edge.Table("user_followers"), edge.Columns("following_id", "followers_id"), edge.Symbol("users_followers")).
From("followers").
StructTag("followers").
Descriptor()
assert.Equal("followers", from.Tag)
assert.Equal("following", from.Ref.Tag)
assert.Equal(edge.StorageKey{Table: "user_followers", Columns: []string{"following_id", "followers_id"}}, *from.Ref.StorageKey)
assert.Equal(edge.StorageKey{Table: "user_followers", Symbols: []string{"users_followers"}, Columns: []string{"following_id", "followers_id"}}, *from.Ref.StorageKey)
}
type GQL struct {