条件查询
Last updated
Last updated
client.Pet.
Query().
Where(user.HasOwner()).
All(ctx) client.Pet.
Query().
Where(user.HasOwnerWith(user.Name("a8m"))).
All(ctx)client.Pet.
Query().
Where(user.Not(user.NameHasPrefix("Ari"))).
All(ctx)client.Pet.
Query().
Where(
user.Or(
user.HasOwner(),
user.Not(user.HasFriends()),
)
).
All(ctx)client.Pet.
Query().
Where(
user.And(
user.HasOwner(),
user.Not(user.HasFriends()),
)
).
All(ctx)pets := client.Pet.
Query().
Where(predicate.Pet(func(s *sql.Selector) {
s.Where(sql.InInts(pet.OwnerColumn, 1, 2, 3))
})).
AllX(ctx)