I am trying to create a query for boltDB using Go.
I have to have a query that checks for the roles and the tenantID. Basically the item has to always contain the role, also if the item has a tenantID it has to match however if the item does not have a tenantID (if it's nil) it also has to return it.
So I came up with the query below that checks for the role and the tenantID, but doesn't check if the tenantID is nil. Could anyone help me with this? What would I need to add to this query would take into account the tenantID of nil?
query := bolthold.Where(roleskey).ContainsAny(bolthold.Slice(roles)...).And(tenantIDKey).Eq(tenantID)
You can use
Or
condition to check if it is equal totenantIDKey
orIsNil
You can also you
In
in place ofContainsAny