mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
schema/edge: add support for configuring foreign-key symbols
Fixed #1423
This commit is contained in:
committed by
Ariel Mashraki
parent
745afde770
commit
f3f03e1edd
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user