Is it possible to impose restrictions on variables in Dgraph?

I recently started studying Dgraph and I had this question: is there something like - Constraints? Let’s say I may have a situation where I need to hard-set that an int predicate should not be null and negative. There can be many such examples, so I am interested in whether there are such features in Dgraph, and if not, they will be?

Based on what you wrote, you can make it work by using has, inequality(combined with others) and cascade. I don’t think it is similar to other RDBMS but I think it can achieve the same result.

We don’t have nullable things in Dgraph. But has and inequality funcs can “simulate” this in some way.

This depends if there is a Github issue for that.

I think @ForsaiR is referring to constrains on the data that’s stored in Dgraph not the data that is retrieved during queries. In which case, Dgraph does not have a feature like that. It’d be great if you could create an issue in github including a bit on what use-case would be served by this feature.

2 Likes

Yes, that’s what I was asking