How to check whether two ecto structs share the same identity (using composite PKs)

Hi all,

I’m trying to figure out whether ecto has a public api function to determine whether two ecto structs share the same identity. For simple structs a comparison of their id’s would be sufficient. But since I’m dealing with a struct that has a composite PK, I was wondering if there is a cleaner way to detect this. Comparing all parts of the composite PK would work, but it seems like something ecto has to know everything about, since it knows about the schema.

Thanks in advance!

1 Like

You cen get primary key fields with:

1 Like

Ok, that brings me closer to a futureproof solution. Thanks!

1 Like