entc/gen: add EqualFold and ContainsFold to string IDs (#3382)

This commit is contained in:
Ariel Mashraki
2023-03-12 11:42:13 +02:00
committed by GitHub
parent 81eb431081
commit bbbedf53af
4 changed files with 31 additions and 1 deletions

View File

@@ -57,6 +57,16 @@ func IDLTE(id string) predicate.Pet {
return predicate.Pet(sql.FieldLTE(FieldID, id))
}
// IDEqualFold applies the EqualFold predicate on the ID field.
func IDEqualFold(id string) predicate.Pet {
return predicate.Pet(sql.FieldEqualFold(FieldID, id))
}
// IDContainsFold applies the ContainsFold predicate on the ID field.
func IDContainsFold(id string) predicate.Pet {
return predicate.Pet(sql.FieldContainsFold(FieldID, id))
}
// HasOwner applies the HasEdge predicate on the "owner" edge.
func HasOwner() predicate.Pet {
return predicate.Pet(func(s *sql.Selector) {

View File

@@ -56,6 +56,16 @@ func IDLTE(id string) predicate.Revision {
return predicate.Revision(sql.FieldLTE(FieldID, id))
}
// IDEqualFold applies the EqualFold predicate on the ID field.
func IDEqualFold(id string) predicate.Revision {
return predicate.Revision(sql.FieldEqualFold(FieldID, id))
}
// IDContainsFold applies the ContainsFold predicate on the ID field.
func IDContainsFold(id string) predicate.Revision {
return predicate.Revision(sql.FieldContainsFold(FieldID, id))
}
// And groups predicates with the AND operator between them.
func And(predicates ...predicate.Revision) predicate.Revision {
return predicate.Revision(func(s *sql.Selector) {

View File

@@ -56,6 +56,16 @@ func IDLTE(id string) predicate.Item {
return predicate.Item(sql.FieldLTE(FieldID, id))
}
// IDEqualFold applies the EqualFold predicate on the ID field.
func IDEqualFold(id string) predicate.Item {
return predicate.Item(sql.FieldEqualFold(FieldID, id))
}
// IDContainsFold applies the ContainsFold predicate on the ID field.
func IDContainsFold(id string) predicate.Item {
return predicate.Item(sql.FieldContainsFold(FieldID, id))
}
// Text applies equality check predicate on the "text" field. It's identical to TextEQ.
func Text(v string) predicate.Item {
return predicate.Item(sql.FieldEQ(FieldText, v))