// Code generated by entc, DO NOT EDIT.

package resourceduration

import (
	"time"

	"entgo.io/ent/dialect/sql"

	"github.com/pingcap/test-infra/common/model"
	"github.com/pingcap/test-infra/services/tcms/service/store/v2/ent/predicate"
)

// ID filters vertices based on their ID field.
func ID(id model.ID) predicate.ResourceDuration {
	return predicate.ResourceDuration(func(s *sql.Selector) {
		s.Where(sql.EQ(s.C(FieldID), id))
	})
}

// IDEQ applies the EQ predicate on the ID field.
func IDEQ(id model.ID) predicate.ResourceDuration {
	return predicate.ResourceDuration(func(s *sql.Selector) {
		s.Where(sql.EQ(s.C(FieldID), id))
	})
}

// IDNEQ applies the NEQ predicate on the ID field.
func IDNEQ(id model.ID) predicate.ResourceDuration {
	return predicate.ResourceDuration(func(s *sql.Selector) {
		s.Where(sql.NEQ(s.C(FieldID), id))
	})
}

// IDIn applies the In predicate on the ID field.
func IDIn(ids ...model.ID) predicate.ResourceDuration {
	return predicate.ResourceDuration(func(s *sql.Selector) {
		// if not arguments were provided, append the FALSE constants,
		// since we can't apply "IN ()". This will make this predicate falsy.
		if len(ids) == 0 {
			s.Where(sql.False())
			return
		}
		v := make([]interface{}, len(ids))
		for i := range v {
			v[i] = ids[i]
		}
		s.Where(sql.In(s.C(FieldID), v...))
	})
}

// IDNotIn applies the NotIn predicate on the ID field.
func IDNotIn(ids ...model.ID) predicate.ResourceDuration {
	return predicate.ResourceDuration(func(s *sql.Selector) {
		// if not arguments were provided, append the FALSE constants,
		// since we can't apply "IN ()". This will make this predicate falsy.
		if len(ids) == 0 {
			s.Where(sql.False())
			return
		}
		v := make([]interface{}, len(ids))
		for i := range v {
			v[i] = ids[i]
		}
		s.Where(sql.NotIn(s.C(FieldID), v...))
	})
}

// IDGT applies the GT predicate on the ID field.
func IDGT(id model.ID) predicate.ResourceDuration {
	return predicate.ResourceDuration(func(s *sql.Selector) {
		s.Where(sql.GT(s.C(FieldID), id))
	})
}

// IDGTE applies the GTE predicate on the ID field.
func IDGTE(id model.ID) predicate.ResourceDuration {
	return predicate.ResourceDuration(func(s *sql.Selector) {
		s.Where(sql.GTE(s.C(FieldID), id))
	})
}

// IDLT applies the LT predicate on the ID field.
func IDLT(id model.ID) predicate.ResourceDuration {
	return predicate.ResourceDuration(func(s *sql.Selector) {
		s.Where(sql.LT(s.C(FieldID), id))
	})
}

// IDLTE applies the LTE predicate on the ID field.
func IDLTE(id model.ID) predicate.ResourceDuration {
	return predicate.ResourceDuration(func(s *sql.Selector) {
		s.Where(sql.LTE(s.C(FieldID), id))
	})
}

// CreatedAt applies equality check predicate on the "createdAt" field. It's identical to CreatedAtEQ.
func CreatedAt(v time.Time) predicate.ResourceDuration {
	return predicate.ResourceDuration(func(s *sql.Selector) {
		s.Where(sql.EQ(s.C(FieldCreatedAt), v))
	})
}

// UpdatedAt applies equality check predicate on the "updatedAt" field. It's identical to UpdatedAtEQ.
func UpdatedAt(v time.Time) predicate.ResourceDuration {
	return predicate.ResourceDuration(func(s *sql.Selector) {
		s.Where(sql.EQ(s.C(FieldUpdatedAt), v))
	})
}

// PlanExecutionID applies equality check predicate on the "planExecutionID" field. It's identical to PlanExecutionIDEQ.
func PlanExecutionID(v model.ID) predicate.ResourceDuration {
	vc := uint64(v)
	return predicate.ResourceDuration(func(s *sql.Selector) {
		s.Where(sql.EQ(s.C(FieldPlanExecutionID), vc))
	})
}

// CpuDuration applies equality check predicate on the "cpuDuration" field. It's identical to CpuDurationEQ.
func CpuDuration(v uint64) predicate.ResourceDuration {
	return predicate.ResourceDuration(func(s *sql.Selector) {
		s.Where(sql.EQ(s.C(FieldCpuDuration), v))
	})
}

// MemoryDuration applies equality check predicate on the "memoryDuration" field. It's identical to MemoryDurationEQ.
func MemoryDuration(v uint64) predicate.ResourceDuration {
	return predicate.ResourceDuration(func(s *sql.Selector) {
		s.Where(sql.EQ(s.C(FieldMemoryDuration), v))
	})
}

// CreatedAtEQ applies the EQ predicate on the "createdAt" field.
func CreatedAtEQ(v time.Time) predicate.ResourceDuration {
	return predicate.ResourceDuration(func(s *sql.Selector) {
		s.Where(sql.EQ(s.C(FieldCreatedAt), v))
	})
}

// CreatedAtNEQ applies the NEQ predicate on the "createdAt" field.
func CreatedAtNEQ(v time.Time) predicate.ResourceDuration {
	return predicate.ResourceDuration(func(s *sql.Selector) {
		s.Where(sql.NEQ(s.C(FieldCreatedAt), v))
	})
}

// CreatedAtIn applies the In predicate on the "createdAt" field.
func CreatedAtIn(vs ...time.Time) predicate.ResourceDuration {
	v := make([]interface{}, len(vs))
	for i := range v {
		v[i] = vs[i]
	}
	return predicate.ResourceDuration(func(s *sql.Selector) {
		// if not arguments were provided, append the FALSE constants,
		// since we can't apply "IN ()". This will make this predicate falsy.
		if len(v) == 0 {
			s.Where(sql.False())
			return
		}
		s.Where(sql.In(s.C(FieldCreatedAt), v...))
	})
}

// CreatedAtNotIn applies the NotIn predicate on the "createdAt" field.
func CreatedAtNotIn(vs ...time.Time) predicate.ResourceDuration {
	v := make([]interface{}, len(vs))
	for i := range v {
		v[i] = vs[i]
	}
	return predicate.ResourceDuration(func(s *sql.Selector) {
		// if not arguments were provided, append the FALSE constants,
		// since we can't apply "IN ()". This will make this predicate falsy.
		if len(v) == 0 {
			s.Where(sql.False())
			return
		}
		s.Where(sql.NotIn(s.C(FieldCreatedAt), v...))
	})
}

// CreatedAtGT applies the GT predicate on the "createdAt" field.
func CreatedAtGT(v time.Time) predicate.ResourceDuration {
	return predicate.ResourceDuration(func(s *sql.Selector) {
		s.Where(sql.GT(s.C(FieldCreatedAt), v))
	})
}

// CreatedAtGTE applies the GTE predicate on the "createdAt" field.
func CreatedAtGTE(v time.Time) predicate.ResourceDuration {
	return predicate.ResourceDuration(func(s *sql.Selector) {
		s.Where(sql.GTE(s.C(FieldCreatedAt), v))
	})
}

// CreatedAtLT applies the LT predicate on the "createdAt" field.
func CreatedAtLT(v time.Time) predicate.ResourceDuration {
	return predicate.ResourceDuration(func(s *sql.Selector) {
		s.Where(sql.LT(s.C(FieldCreatedAt), v))
	})
}

// CreatedAtLTE applies the LTE predicate on the "createdAt" field.
func CreatedAtLTE(v time.Time) predicate.ResourceDuration {
	return predicate.ResourceDuration(func(s *sql.Selector) {
		s.Where(sql.LTE(s.C(FieldCreatedAt), v))
	})
}

// UpdatedAtEQ applies the EQ predicate on the "updatedAt" field.
func UpdatedAtEQ(v time.Time) predicate.ResourceDuration {
	return predicate.ResourceDuration(func(s *sql.Selector) {
		s.Where(sql.EQ(s.C(FieldUpdatedAt), v))
	})
}

// UpdatedAtNEQ applies the NEQ predicate on the "updatedAt" field.
func UpdatedAtNEQ(v time.Time) predicate.ResourceDuration {
	return predicate.ResourceDuration(func(s *sql.Selector) {
		s.Where(sql.NEQ(s.C(FieldUpdatedAt), v))
	})
}

// UpdatedAtIn applies the In predicate on the "updatedAt" field.
func UpdatedAtIn(vs ...time.Time) predicate.ResourceDuration {
	v := make([]interface{}, len(vs))
	for i := range v {
		v[i] = vs[i]
	}
	return predicate.ResourceDuration(func(s *sql.Selector) {
		// if not arguments were provided, append the FALSE constants,
		// since we can't apply "IN ()". This will make this predicate falsy.
		if len(v) == 0 {
			s.Where(sql.False())
			return
		}
		s.Where(sql.In(s.C(FieldUpdatedAt), v...))
	})
}

// UpdatedAtNotIn applies the NotIn predicate on the "updatedAt" field.
func UpdatedAtNotIn(vs ...time.Time) predicate.ResourceDuration {
	v := make([]interface{}, len(vs))
	for i := range v {
		v[i] = vs[i]
	}
	return predicate.ResourceDuration(func(s *sql.Selector) {
		// if not arguments were provided, append the FALSE constants,
		// since we can't apply "IN ()". This will make this predicate falsy.
		if len(v) == 0 {
			s.Where(sql.False())
			return
		}
		s.Where(sql.NotIn(s.C(FieldUpdatedAt), v...))
	})
}

// UpdatedAtGT applies the GT predicate on the "updatedAt" field.
func UpdatedAtGT(v time.Time) predicate.ResourceDuration {
	return predicate.ResourceDuration(func(s *sql.Selector) {
		s.Where(sql.GT(s.C(FieldUpdatedAt), v))
	})
}

// UpdatedAtGTE applies the GTE predicate on the "updatedAt" field.
func UpdatedAtGTE(v time.Time) predicate.ResourceDuration {
	return predicate.ResourceDuration(func(s *sql.Selector) {
		s.Where(sql.GTE(s.C(FieldUpdatedAt), v))
	})
}

// UpdatedAtLT applies the LT predicate on the "updatedAt" field.
func UpdatedAtLT(v time.Time) predicate.ResourceDuration {
	return predicate.ResourceDuration(func(s *sql.Selector) {
		s.Where(sql.LT(s.C(FieldUpdatedAt), v))
	})
}

// UpdatedAtLTE applies the LTE predicate on the "updatedAt" field.
func UpdatedAtLTE(v time.Time) predicate.ResourceDuration {
	return predicate.ResourceDuration(func(s *sql.Selector) {
		s.Where(sql.LTE(s.C(FieldUpdatedAt), v))
	})
}

// PlanExecutionIDEQ applies the EQ predicate on the "planExecutionID" field.
func PlanExecutionIDEQ(v model.ID) predicate.ResourceDuration {
	vc := uint64(v)
	return predicate.ResourceDuration(func(s *sql.Selector) {
		s.Where(sql.EQ(s.C(FieldPlanExecutionID), vc))
	})
}

// PlanExecutionIDNEQ applies the NEQ predicate on the "planExecutionID" field.
func PlanExecutionIDNEQ(v model.ID) predicate.ResourceDuration {
	vc := uint64(v)
	return predicate.ResourceDuration(func(s *sql.Selector) {
		s.Where(sql.NEQ(s.C(FieldPlanExecutionID), vc))
	})
}

// PlanExecutionIDIn applies the In predicate on the "planExecutionID" field.
func PlanExecutionIDIn(vs ...model.ID) predicate.ResourceDuration {
	v := make([]interface{}, len(vs))
	for i := range v {
		v[i] = uint64(vs[i])
	}
	return predicate.ResourceDuration(func(s *sql.Selector) {
		// if not arguments were provided, append the FALSE constants,
		// since we can't apply "IN ()". This will make this predicate falsy.
		if len(v) == 0 {
			s.Where(sql.False())
			return
		}
		s.Where(sql.In(s.C(FieldPlanExecutionID), v...))
	})
}

// PlanExecutionIDNotIn applies the NotIn predicate on the "planExecutionID" field.
func PlanExecutionIDNotIn(vs ...model.ID) predicate.ResourceDuration {
	v := make([]interface{}, len(vs))
	for i := range v {
		v[i] = uint64(vs[i])
	}
	return predicate.ResourceDuration(func(s *sql.Selector) {
		// if not arguments were provided, append the FALSE constants,
		// since we can't apply "IN ()". This will make this predicate falsy.
		if len(v) == 0 {
			s.Where(sql.False())
			return
		}
		s.Where(sql.NotIn(s.C(FieldPlanExecutionID), v...))
	})
}

// PlanExecutionIDGT applies the GT predicate on the "planExecutionID" field.
func PlanExecutionIDGT(v model.ID) predicate.ResourceDuration {
	vc := uint64(v)
	return predicate.ResourceDuration(func(s *sql.Selector) {
		s.Where(sql.GT(s.C(FieldPlanExecutionID), vc))
	})
}

// PlanExecutionIDGTE applies the GTE predicate on the "planExecutionID" field.
func PlanExecutionIDGTE(v model.ID) predicate.ResourceDuration {
	vc := uint64(v)
	return predicate.ResourceDuration(func(s *sql.Selector) {
		s.Where(sql.GTE(s.C(FieldPlanExecutionID), vc))
	})
}

// PlanExecutionIDLT applies the LT predicate on the "planExecutionID" field.
func PlanExecutionIDLT(v model.ID) predicate.ResourceDuration {
	vc := uint64(v)
	return predicate.ResourceDuration(func(s *sql.Selector) {
		s.Where(sql.LT(s.C(FieldPlanExecutionID), vc))
	})
}

// PlanExecutionIDLTE applies the LTE predicate on the "planExecutionID" field.
func PlanExecutionIDLTE(v model.ID) predicate.ResourceDuration {
	vc := uint64(v)
	return predicate.ResourceDuration(func(s *sql.Selector) {
		s.Where(sql.LTE(s.C(FieldPlanExecutionID), vc))
	})
}

// TypeEQ applies the EQ predicate on the "type" field.
func TypeEQ(v model.ResourceDurationType) predicate.ResourceDuration {
	vc := v
	return predicate.ResourceDuration(func(s *sql.Selector) {
		s.Where(sql.EQ(s.C(FieldType), vc))
	})
}

// TypeNEQ applies the NEQ predicate on the "type" field.
func TypeNEQ(v model.ResourceDurationType) predicate.ResourceDuration {
	vc := v
	return predicate.ResourceDuration(func(s *sql.Selector) {
		s.Where(sql.NEQ(s.C(FieldType), vc))
	})
}

// TypeIn applies the In predicate on the "type" field.
func TypeIn(vs ...model.ResourceDurationType) predicate.ResourceDuration {
	v := make([]interface{}, len(vs))
	for i := range v {
		v[i] = vs[i]
	}
	return predicate.ResourceDuration(func(s *sql.Selector) {
		// if not arguments were provided, append the FALSE constants,
		// since we can't apply "IN ()". This will make this predicate falsy.
		if len(v) == 0 {
			s.Where(sql.False())
			return
		}
		s.Where(sql.In(s.C(FieldType), v...))
	})
}

// TypeNotIn applies the NotIn predicate on the "type" field.
func TypeNotIn(vs ...model.ResourceDurationType) predicate.ResourceDuration {
	v := make([]interface{}, len(vs))
	for i := range v {
		v[i] = vs[i]
	}
	return predicate.ResourceDuration(func(s *sql.Selector) {
		// if not arguments were provided, append the FALSE constants,
		// since we can't apply "IN ()". This will make this predicate falsy.
		if len(v) == 0 {
			s.Where(sql.False())
			return
		}
		s.Where(sql.NotIn(s.C(FieldType), v...))
	})
}

// CpuDurationEQ applies the EQ predicate on the "cpuDuration" field.
func CpuDurationEQ(v uint64) predicate.ResourceDuration {
	return predicate.ResourceDuration(func(s *sql.Selector) {
		s.Where(sql.EQ(s.C(FieldCpuDuration), v))
	})
}

// CpuDurationNEQ applies the NEQ predicate on the "cpuDuration" field.
func CpuDurationNEQ(v uint64) predicate.ResourceDuration {
	return predicate.ResourceDuration(func(s *sql.Selector) {
		s.Where(sql.NEQ(s.C(FieldCpuDuration), v))
	})
}

// CpuDurationIn applies the In predicate on the "cpuDuration" field.
func CpuDurationIn(vs ...uint64) predicate.ResourceDuration {
	v := make([]interface{}, len(vs))
	for i := range v {
		v[i] = vs[i]
	}
	return predicate.ResourceDuration(func(s *sql.Selector) {
		// if not arguments were provided, append the FALSE constants,
		// since we can't apply "IN ()". This will make this predicate falsy.
		if len(v) == 0 {
			s.Where(sql.False())
			return
		}
		s.Where(sql.In(s.C(FieldCpuDuration), v...))
	})
}

// CpuDurationNotIn applies the NotIn predicate on the "cpuDuration" field.
func CpuDurationNotIn(vs ...uint64) predicate.ResourceDuration {
	v := make([]interface{}, len(vs))
	for i := range v {
		v[i] = vs[i]
	}
	return predicate.ResourceDuration(func(s *sql.Selector) {
		// if not arguments were provided, append the FALSE constants,
		// since we can't apply "IN ()". This will make this predicate falsy.
		if len(v) == 0 {
			s.Where(sql.False())
			return
		}
		s.Where(sql.NotIn(s.C(FieldCpuDuration), v...))
	})
}

// CpuDurationGT applies the GT predicate on the "cpuDuration" field.
func CpuDurationGT(v uint64) predicate.ResourceDuration {
	return predicate.ResourceDuration(func(s *sql.Selector) {
		s.Where(sql.GT(s.C(FieldCpuDuration), v))
	})
}

// CpuDurationGTE applies the GTE predicate on the "cpuDuration" field.
func CpuDurationGTE(v uint64) predicate.ResourceDuration {
	return predicate.ResourceDuration(func(s *sql.Selector) {
		s.Where(sql.GTE(s.C(FieldCpuDuration), v))
	})
}

// CpuDurationLT applies the LT predicate on the "cpuDuration" field.
func CpuDurationLT(v uint64) predicate.ResourceDuration {
	return predicate.ResourceDuration(func(s *sql.Selector) {
		s.Where(sql.LT(s.C(FieldCpuDuration), v))
	})
}

// CpuDurationLTE applies the LTE predicate on the "cpuDuration" field.
func CpuDurationLTE(v uint64) predicate.ResourceDuration {
	return predicate.ResourceDuration(func(s *sql.Selector) {
		s.Where(sql.LTE(s.C(FieldCpuDuration), v))
	})
}

// MemoryDurationEQ applies the EQ predicate on the "memoryDuration" field.
func MemoryDurationEQ(v uint64) predicate.ResourceDuration {
	return predicate.ResourceDuration(func(s *sql.Selector) {
		s.Where(sql.EQ(s.C(FieldMemoryDuration), v))
	})
}

// MemoryDurationNEQ applies the NEQ predicate on the "memoryDuration" field.
func MemoryDurationNEQ(v uint64) predicate.ResourceDuration {
	return predicate.ResourceDuration(func(s *sql.Selector) {
		s.Where(sql.NEQ(s.C(FieldMemoryDuration), v))
	})
}

// MemoryDurationIn applies the In predicate on the "memoryDuration" field.
func MemoryDurationIn(vs ...uint64) predicate.ResourceDuration {
	v := make([]interface{}, len(vs))
	for i := range v {
		v[i] = vs[i]
	}
	return predicate.ResourceDuration(func(s *sql.Selector) {
		// if not arguments were provided, append the FALSE constants,
		// since we can't apply "IN ()". This will make this predicate falsy.
		if len(v) == 0 {
			s.Where(sql.False())
			return
		}
		s.Where(sql.In(s.C(FieldMemoryDuration), v...))
	})
}

// MemoryDurationNotIn applies the NotIn predicate on the "memoryDuration" field.
func MemoryDurationNotIn(vs ...uint64) predicate.ResourceDuration {
	v := make([]interface{}, len(vs))
	for i := range v {
		v[i] = vs[i]
	}
	return predicate.ResourceDuration(func(s *sql.Selector) {
		// if not arguments were provided, append the FALSE constants,
		// since we can't apply "IN ()". This will make this predicate falsy.
		if len(v) == 0 {
			s.Where(sql.False())
			return
		}
		s.Where(sql.NotIn(s.C(FieldMemoryDuration), v...))
	})
}

// MemoryDurationGT applies the GT predicate on the "memoryDuration" field.
func MemoryDurationGT(v uint64) predicate.ResourceDuration {
	return predicate.ResourceDuration(func(s *sql.Selector) {
		s.Where(sql.GT(s.C(FieldMemoryDuration), v))
	})
}

// MemoryDurationGTE applies the GTE predicate on the "memoryDuration" field.
func MemoryDurationGTE(v uint64) predicate.ResourceDuration {
	return predicate.ResourceDuration(func(s *sql.Selector) {
		s.Where(sql.GTE(s.C(FieldMemoryDuration), v))
	})
}

// MemoryDurationLT applies the LT predicate on the "memoryDuration" field.
func MemoryDurationLT(v uint64) predicate.ResourceDuration {
	return predicate.ResourceDuration(func(s *sql.Selector) {
		s.Where(sql.LT(s.C(FieldMemoryDuration), v))
	})
}

// MemoryDurationLTE applies the LTE predicate on the "memoryDuration" field.
func MemoryDurationLTE(v uint64) predicate.ResourceDuration {
	return predicate.ResourceDuration(func(s *sql.Selector) {
		s.Where(sql.LTE(s.C(FieldMemoryDuration), v))
	})
}

// And groups predicates with the AND operator between them.
func And(predicates ...predicate.ResourceDuration) predicate.ResourceDuration {
	return predicate.ResourceDuration(func(s *sql.Selector) {
		s1 := s.Clone().SetP(nil)
		for _, p := range predicates {
			p(s1)
		}
		s.Where(s1.P())
	})
}

// Or groups predicates with the OR operator between them.
func Or(predicates ...predicate.ResourceDuration) predicate.ResourceDuration {
	return predicate.ResourceDuration(func(s *sql.Selector) {
		s1 := s.Clone().SetP(nil)
		for i, p := range predicates {
			if i > 0 {
				s1.Or()
			}
			p(s1)
		}
		s.Where(s1.P())
	})
}

// Not applies the not operator on the given predicate.
func Not(p predicate.ResourceDuration) predicate.ResourceDuration {
	return predicate.ResourceDuration(func(s *sql.Selector) {
		p(s.Not())
	})
}
