entc/gen: skip checking required fields with db-based default values (#3204)

This commit is contained in:
Ariel Mashraki
2023-01-02 22:59:27 +02:00
committed by GitHub
parent 41bf915604
commit 542f36d4ab
12 changed files with 298 additions and 9 deletions

View File

@@ -11,6 +11,8 @@ const (
Label = "blog"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldOid holds the string denoting the oid field in the database.
FieldOid = "oid"
// EdgeAdmins holds the string denoting the admins edge name in mutations.
EdgeAdmins = "admins"
// UserFieldID holds the string denoting the ID field of the User.
@@ -29,6 +31,7 @@ const (
// Columns holds all SQL columns for blog fields.
var Columns = []string{
FieldID,
FieldOid,
}
// ValidColumn reports if the column name is valid (part of the table columns).

View File

@@ -57,6 +57,51 @@ func IDLTE(id int) predicate.Blog {
return predicate.Blog(sql.FieldLTE(FieldID, id))
}
// Oid applies equality check predicate on the "oid" field. It's identical to OidEQ.
func Oid(v int) predicate.Blog {
return predicate.Blog(sql.FieldEQ(FieldOid, v))
}
// OidEQ applies the EQ predicate on the "oid" field.
func OidEQ(v int) predicate.Blog {
return predicate.Blog(sql.FieldEQ(FieldOid, v))
}
// OidNEQ applies the NEQ predicate on the "oid" field.
func OidNEQ(v int) predicate.Blog {
return predicate.Blog(sql.FieldNEQ(FieldOid, v))
}
// OidIn applies the In predicate on the "oid" field.
func OidIn(vs ...int) predicate.Blog {
return predicate.Blog(sql.FieldIn(FieldOid, vs...))
}
// OidNotIn applies the NotIn predicate on the "oid" field.
func OidNotIn(vs ...int) predicate.Blog {
return predicate.Blog(sql.FieldNotIn(FieldOid, vs...))
}
// OidGT applies the GT predicate on the "oid" field.
func OidGT(v int) predicate.Blog {
return predicate.Blog(sql.FieldGT(FieldOid, v))
}
// OidGTE applies the GTE predicate on the "oid" field.
func OidGTE(v int) predicate.Blog {
return predicate.Blog(sql.FieldGTE(FieldOid, v))
}
// OidLT applies the LT predicate on the "oid" field.
func OidLT(v int) predicate.Blog {
return predicate.Blog(sql.FieldLT(FieldOid, v))
}
// OidLTE applies the LTE predicate on the "oid" field.
func OidLTE(v int) predicate.Blog {
return predicate.Blog(sql.FieldLTE(FieldOid, v))
}
// HasAdmins applies the HasEdge predicate on the "admins" edge.
func HasAdmins() predicate.Blog {
return predicate.Blog(func(s *sql.Selector) {