Add ent autogenerated code
Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>
This commit is contained in:
539
storage/ent/db/offlinesession/where.go
Normal file
539
storage/ent/db/offlinesession/where.go
Normal file
@@ -0,0 +1,539 @@
|
||||
// Code generated by entc, DO NOT EDIT.
|
||||
|
||||
package offlinesession
|
||||
|
||||
import (
|
||||
"github.com/dexidp/dex/storage/ent/db/predicate"
|
||||
"github.com/facebook/ent/dialect/sql"
|
||||
)
|
||||
|
||||
// ID filters vertices based on their ID field.
|
||||
func ID(id string) predicate.OfflineSession {
|
||||
return predicate.OfflineSession(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldID), id))
|
||||
})
|
||||
}
|
||||
|
||||
// IDEQ applies the EQ predicate on the ID field.
|
||||
func IDEQ(id string) predicate.OfflineSession {
|
||||
return predicate.OfflineSession(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldID), id))
|
||||
})
|
||||
}
|
||||
|
||||
// IDNEQ applies the NEQ predicate on the ID field.
|
||||
func IDNEQ(id string) predicate.OfflineSession {
|
||||
return predicate.OfflineSession(func(s *sql.Selector) {
|
||||
s.Where(sql.NEQ(s.C(FieldID), id))
|
||||
})
|
||||
}
|
||||
|
||||
// IDIn applies the In predicate on the ID field.
|
||||
func IDIn(ids ...string) predicate.OfflineSession {
|
||||
return predicate.OfflineSession(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 ...string) predicate.OfflineSession {
|
||||
return predicate.OfflineSession(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 string) predicate.OfflineSession {
|
||||
return predicate.OfflineSession(func(s *sql.Selector) {
|
||||
s.Where(sql.GT(s.C(FieldID), id))
|
||||
})
|
||||
}
|
||||
|
||||
// IDGTE applies the GTE predicate on the ID field.
|
||||
func IDGTE(id string) predicate.OfflineSession {
|
||||
return predicate.OfflineSession(func(s *sql.Selector) {
|
||||
s.Where(sql.GTE(s.C(FieldID), id))
|
||||
})
|
||||
}
|
||||
|
||||
// IDLT applies the LT predicate on the ID field.
|
||||
func IDLT(id string) predicate.OfflineSession {
|
||||
return predicate.OfflineSession(func(s *sql.Selector) {
|
||||
s.Where(sql.LT(s.C(FieldID), id))
|
||||
})
|
||||
}
|
||||
|
||||
// IDLTE applies the LTE predicate on the ID field.
|
||||
func IDLTE(id string) predicate.OfflineSession {
|
||||
return predicate.OfflineSession(func(s *sql.Selector) {
|
||||
s.Where(sql.LTE(s.C(FieldID), id))
|
||||
})
|
||||
}
|
||||
|
||||
// UserID applies equality check predicate on the "user_id" field. It's identical to UserIDEQ.
|
||||
func UserID(v string) predicate.OfflineSession {
|
||||
return predicate.OfflineSession(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldUserID), v))
|
||||
})
|
||||
}
|
||||
|
||||
// ConnID applies equality check predicate on the "conn_id" field. It's identical to ConnIDEQ.
|
||||
func ConnID(v string) predicate.OfflineSession {
|
||||
return predicate.OfflineSession(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldConnID), v))
|
||||
})
|
||||
}
|
||||
|
||||
// Refresh applies equality check predicate on the "refresh" field. It's identical to RefreshEQ.
|
||||
func Refresh(v []byte) predicate.OfflineSession {
|
||||
return predicate.OfflineSession(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldRefresh), v))
|
||||
})
|
||||
}
|
||||
|
||||
// ConnectorData applies equality check predicate on the "connector_data" field. It's identical to ConnectorDataEQ.
|
||||
func ConnectorData(v []byte) predicate.OfflineSession {
|
||||
return predicate.OfflineSession(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldConnectorData), v))
|
||||
})
|
||||
}
|
||||
|
||||
// UserIDEQ applies the EQ predicate on the "user_id" field.
|
||||
func UserIDEQ(v string) predicate.OfflineSession {
|
||||
return predicate.OfflineSession(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldUserID), v))
|
||||
})
|
||||
}
|
||||
|
||||
// UserIDNEQ applies the NEQ predicate on the "user_id" field.
|
||||
func UserIDNEQ(v string) predicate.OfflineSession {
|
||||
return predicate.OfflineSession(func(s *sql.Selector) {
|
||||
s.Where(sql.NEQ(s.C(FieldUserID), v))
|
||||
})
|
||||
}
|
||||
|
||||
// UserIDIn applies the In predicate on the "user_id" field.
|
||||
func UserIDIn(vs ...string) predicate.OfflineSession {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
return predicate.OfflineSession(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(FieldUserID), v...))
|
||||
})
|
||||
}
|
||||
|
||||
// UserIDNotIn applies the NotIn predicate on the "user_id" field.
|
||||
func UserIDNotIn(vs ...string) predicate.OfflineSession {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
return predicate.OfflineSession(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(FieldUserID), v...))
|
||||
})
|
||||
}
|
||||
|
||||
// UserIDGT applies the GT predicate on the "user_id" field.
|
||||
func UserIDGT(v string) predicate.OfflineSession {
|
||||
return predicate.OfflineSession(func(s *sql.Selector) {
|
||||
s.Where(sql.GT(s.C(FieldUserID), v))
|
||||
})
|
||||
}
|
||||
|
||||
// UserIDGTE applies the GTE predicate on the "user_id" field.
|
||||
func UserIDGTE(v string) predicate.OfflineSession {
|
||||
return predicate.OfflineSession(func(s *sql.Selector) {
|
||||
s.Where(sql.GTE(s.C(FieldUserID), v))
|
||||
})
|
||||
}
|
||||
|
||||
// UserIDLT applies the LT predicate on the "user_id" field.
|
||||
func UserIDLT(v string) predicate.OfflineSession {
|
||||
return predicate.OfflineSession(func(s *sql.Selector) {
|
||||
s.Where(sql.LT(s.C(FieldUserID), v))
|
||||
})
|
||||
}
|
||||
|
||||
// UserIDLTE applies the LTE predicate on the "user_id" field.
|
||||
func UserIDLTE(v string) predicate.OfflineSession {
|
||||
return predicate.OfflineSession(func(s *sql.Selector) {
|
||||
s.Where(sql.LTE(s.C(FieldUserID), v))
|
||||
})
|
||||
}
|
||||
|
||||
// UserIDContains applies the Contains predicate on the "user_id" field.
|
||||
func UserIDContains(v string) predicate.OfflineSession {
|
||||
return predicate.OfflineSession(func(s *sql.Selector) {
|
||||
s.Where(sql.Contains(s.C(FieldUserID), v))
|
||||
})
|
||||
}
|
||||
|
||||
// UserIDHasPrefix applies the HasPrefix predicate on the "user_id" field.
|
||||
func UserIDHasPrefix(v string) predicate.OfflineSession {
|
||||
return predicate.OfflineSession(func(s *sql.Selector) {
|
||||
s.Where(sql.HasPrefix(s.C(FieldUserID), v))
|
||||
})
|
||||
}
|
||||
|
||||
// UserIDHasSuffix applies the HasSuffix predicate on the "user_id" field.
|
||||
func UserIDHasSuffix(v string) predicate.OfflineSession {
|
||||
return predicate.OfflineSession(func(s *sql.Selector) {
|
||||
s.Where(sql.HasSuffix(s.C(FieldUserID), v))
|
||||
})
|
||||
}
|
||||
|
||||
// UserIDEqualFold applies the EqualFold predicate on the "user_id" field.
|
||||
func UserIDEqualFold(v string) predicate.OfflineSession {
|
||||
return predicate.OfflineSession(func(s *sql.Selector) {
|
||||
s.Where(sql.EqualFold(s.C(FieldUserID), v))
|
||||
})
|
||||
}
|
||||
|
||||
// UserIDContainsFold applies the ContainsFold predicate on the "user_id" field.
|
||||
func UserIDContainsFold(v string) predicate.OfflineSession {
|
||||
return predicate.OfflineSession(func(s *sql.Selector) {
|
||||
s.Where(sql.ContainsFold(s.C(FieldUserID), v))
|
||||
})
|
||||
}
|
||||
|
||||
// ConnIDEQ applies the EQ predicate on the "conn_id" field.
|
||||
func ConnIDEQ(v string) predicate.OfflineSession {
|
||||
return predicate.OfflineSession(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldConnID), v))
|
||||
})
|
||||
}
|
||||
|
||||
// ConnIDNEQ applies the NEQ predicate on the "conn_id" field.
|
||||
func ConnIDNEQ(v string) predicate.OfflineSession {
|
||||
return predicate.OfflineSession(func(s *sql.Selector) {
|
||||
s.Where(sql.NEQ(s.C(FieldConnID), v))
|
||||
})
|
||||
}
|
||||
|
||||
// ConnIDIn applies the In predicate on the "conn_id" field.
|
||||
func ConnIDIn(vs ...string) predicate.OfflineSession {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
return predicate.OfflineSession(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(FieldConnID), v...))
|
||||
})
|
||||
}
|
||||
|
||||
// ConnIDNotIn applies the NotIn predicate on the "conn_id" field.
|
||||
func ConnIDNotIn(vs ...string) predicate.OfflineSession {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
return predicate.OfflineSession(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(FieldConnID), v...))
|
||||
})
|
||||
}
|
||||
|
||||
// ConnIDGT applies the GT predicate on the "conn_id" field.
|
||||
func ConnIDGT(v string) predicate.OfflineSession {
|
||||
return predicate.OfflineSession(func(s *sql.Selector) {
|
||||
s.Where(sql.GT(s.C(FieldConnID), v))
|
||||
})
|
||||
}
|
||||
|
||||
// ConnIDGTE applies the GTE predicate on the "conn_id" field.
|
||||
func ConnIDGTE(v string) predicate.OfflineSession {
|
||||
return predicate.OfflineSession(func(s *sql.Selector) {
|
||||
s.Where(sql.GTE(s.C(FieldConnID), v))
|
||||
})
|
||||
}
|
||||
|
||||
// ConnIDLT applies the LT predicate on the "conn_id" field.
|
||||
func ConnIDLT(v string) predicate.OfflineSession {
|
||||
return predicate.OfflineSession(func(s *sql.Selector) {
|
||||
s.Where(sql.LT(s.C(FieldConnID), v))
|
||||
})
|
||||
}
|
||||
|
||||
// ConnIDLTE applies the LTE predicate on the "conn_id" field.
|
||||
func ConnIDLTE(v string) predicate.OfflineSession {
|
||||
return predicate.OfflineSession(func(s *sql.Selector) {
|
||||
s.Where(sql.LTE(s.C(FieldConnID), v))
|
||||
})
|
||||
}
|
||||
|
||||
// ConnIDContains applies the Contains predicate on the "conn_id" field.
|
||||
func ConnIDContains(v string) predicate.OfflineSession {
|
||||
return predicate.OfflineSession(func(s *sql.Selector) {
|
||||
s.Where(sql.Contains(s.C(FieldConnID), v))
|
||||
})
|
||||
}
|
||||
|
||||
// ConnIDHasPrefix applies the HasPrefix predicate on the "conn_id" field.
|
||||
func ConnIDHasPrefix(v string) predicate.OfflineSession {
|
||||
return predicate.OfflineSession(func(s *sql.Selector) {
|
||||
s.Where(sql.HasPrefix(s.C(FieldConnID), v))
|
||||
})
|
||||
}
|
||||
|
||||
// ConnIDHasSuffix applies the HasSuffix predicate on the "conn_id" field.
|
||||
func ConnIDHasSuffix(v string) predicate.OfflineSession {
|
||||
return predicate.OfflineSession(func(s *sql.Selector) {
|
||||
s.Where(sql.HasSuffix(s.C(FieldConnID), v))
|
||||
})
|
||||
}
|
||||
|
||||
// ConnIDEqualFold applies the EqualFold predicate on the "conn_id" field.
|
||||
func ConnIDEqualFold(v string) predicate.OfflineSession {
|
||||
return predicate.OfflineSession(func(s *sql.Selector) {
|
||||
s.Where(sql.EqualFold(s.C(FieldConnID), v))
|
||||
})
|
||||
}
|
||||
|
||||
// ConnIDContainsFold applies the ContainsFold predicate on the "conn_id" field.
|
||||
func ConnIDContainsFold(v string) predicate.OfflineSession {
|
||||
return predicate.OfflineSession(func(s *sql.Selector) {
|
||||
s.Where(sql.ContainsFold(s.C(FieldConnID), v))
|
||||
})
|
||||
}
|
||||
|
||||
// RefreshEQ applies the EQ predicate on the "refresh" field.
|
||||
func RefreshEQ(v []byte) predicate.OfflineSession {
|
||||
return predicate.OfflineSession(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldRefresh), v))
|
||||
})
|
||||
}
|
||||
|
||||
// RefreshNEQ applies the NEQ predicate on the "refresh" field.
|
||||
func RefreshNEQ(v []byte) predicate.OfflineSession {
|
||||
return predicate.OfflineSession(func(s *sql.Selector) {
|
||||
s.Where(sql.NEQ(s.C(FieldRefresh), v))
|
||||
})
|
||||
}
|
||||
|
||||
// RefreshIn applies the In predicate on the "refresh" field.
|
||||
func RefreshIn(vs ...[]byte) predicate.OfflineSession {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
return predicate.OfflineSession(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(FieldRefresh), v...))
|
||||
})
|
||||
}
|
||||
|
||||
// RefreshNotIn applies the NotIn predicate on the "refresh" field.
|
||||
func RefreshNotIn(vs ...[]byte) predicate.OfflineSession {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
return predicate.OfflineSession(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(FieldRefresh), v...))
|
||||
})
|
||||
}
|
||||
|
||||
// RefreshGT applies the GT predicate on the "refresh" field.
|
||||
func RefreshGT(v []byte) predicate.OfflineSession {
|
||||
return predicate.OfflineSession(func(s *sql.Selector) {
|
||||
s.Where(sql.GT(s.C(FieldRefresh), v))
|
||||
})
|
||||
}
|
||||
|
||||
// RefreshGTE applies the GTE predicate on the "refresh" field.
|
||||
func RefreshGTE(v []byte) predicate.OfflineSession {
|
||||
return predicate.OfflineSession(func(s *sql.Selector) {
|
||||
s.Where(sql.GTE(s.C(FieldRefresh), v))
|
||||
})
|
||||
}
|
||||
|
||||
// RefreshLT applies the LT predicate on the "refresh" field.
|
||||
func RefreshLT(v []byte) predicate.OfflineSession {
|
||||
return predicate.OfflineSession(func(s *sql.Selector) {
|
||||
s.Where(sql.LT(s.C(FieldRefresh), v))
|
||||
})
|
||||
}
|
||||
|
||||
// RefreshLTE applies the LTE predicate on the "refresh" field.
|
||||
func RefreshLTE(v []byte) predicate.OfflineSession {
|
||||
return predicate.OfflineSession(func(s *sql.Selector) {
|
||||
s.Where(sql.LTE(s.C(FieldRefresh), v))
|
||||
})
|
||||
}
|
||||
|
||||
// ConnectorDataEQ applies the EQ predicate on the "connector_data" field.
|
||||
func ConnectorDataEQ(v []byte) predicate.OfflineSession {
|
||||
return predicate.OfflineSession(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldConnectorData), v))
|
||||
})
|
||||
}
|
||||
|
||||
// ConnectorDataNEQ applies the NEQ predicate on the "connector_data" field.
|
||||
func ConnectorDataNEQ(v []byte) predicate.OfflineSession {
|
||||
return predicate.OfflineSession(func(s *sql.Selector) {
|
||||
s.Where(sql.NEQ(s.C(FieldConnectorData), v))
|
||||
})
|
||||
}
|
||||
|
||||
// ConnectorDataIn applies the In predicate on the "connector_data" field.
|
||||
func ConnectorDataIn(vs ...[]byte) predicate.OfflineSession {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
return predicate.OfflineSession(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(FieldConnectorData), v...))
|
||||
})
|
||||
}
|
||||
|
||||
// ConnectorDataNotIn applies the NotIn predicate on the "connector_data" field.
|
||||
func ConnectorDataNotIn(vs ...[]byte) predicate.OfflineSession {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
return predicate.OfflineSession(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(FieldConnectorData), v...))
|
||||
})
|
||||
}
|
||||
|
||||
// ConnectorDataGT applies the GT predicate on the "connector_data" field.
|
||||
func ConnectorDataGT(v []byte) predicate.OfflineSession {
|
||||
return predicate.OfflineSession(func(s *sql.Selector) {
|
||||
s.Where(sql.GT(s.C(FieldConnectorData), v))
|
||||
})
|
||||
}
|
||||
|
||||
// ConnectorDataGTE applies the GTE predicate on the "connector_data" field.
|
||||
func ConnectorDataGTE(v []byte) predicate.OfflineSession {
|
||||
return predicate.OfflineSession(func(s *sql.Selector) {
|
||||
s.Where(sql.GTE(s.C(FieldConnectorData), v))
|
||||
})
|
||||
}
|
||||
|
||||
// ConnectorDataLT applies the LT predicate on the "connector_data" field.
|
||||
func ConnectorDataLT(v []byte) predicate.OfflineSession {
|
||||
return predicate.OfflineSession(func(s *sql.Selector) {
|
||||
s.Where(sql.LT(s.C(FieldConnectorData), v))
|
||||
})
|
||||
}
|
||||
|
||||
// ConnectorDataLTE applies the LTE predicate on the "connector_data" field.
|
||||
func ConnectorDataLTE(v []byte) predicate.OfflineSession {
|
||||
return predicate.OfflineSession(func(s *sql.Selector) {
|
||||
s.Where(sql.LTE(s.C(FieldConnectorData), v))
|
||||
})
|
||||
}
|
||||
|
||||
// ConnectorDataIsNil applies the IsNil predicate on the "connector_data" field.
|
||||
func ConnectorDataIsNil() predicate.OfflineSession {
|
||||
return predicate.OfflineSession(func(s *sql.Selector) {
|
||||
s.Where(sql.IsNull(s.C(FieldConnectorData)))
|
||||
})
|
||||
}
|
||||
|
||||
// ConnectorDataNotNil applies the NotNil predicate on the "connector_data" field.
|
||||
func ConnectorDataNotNil() predicate.OfflineSession {
|
||||
return predicate.OfflineSession(func(s *sql.Selector) {
|
||||
s.Where(sql.NotNull(s.C(FieldConnectorData)))
|
||||
})
|
||||
}
|
||||
|
||||
// And groups predicates with the AND operator between them.
|
||||
func And(predicates ...predicate.OfflineSession) predicate.OfflineSession {
|
||||
return predicate.OfflineSession(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.OfflineSession) predicate.OfflineSession {
|
||||
return predicate.OfflineSession(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.OfflineSession) predicate.OfflineSession {
|
||||
return predicate.OfflineSession(func(s *sql.Selector) {
|
||||
p(s.Not())
|
||||
})
|
||||
}
|
Reference in New Issue
Block a user