bitbucket.org/Aishee/synsec@v0.0.0-20210414005726-236fc01a153d/pkg/database/ent/event/where.go (about)

     1  // Code generated by entc, DO NOT EDIT.
     2  
     3  package event
     4  
     5  import (
     6  	"time"
     7  
     8  	"entgo.io/ent/dialect/sql"
     9  	"entgo.io/ent/dialect/sql/sqlgraph"
    10  	"bitbucket.org/Aishee/synsec/pkg/database/ent/predicate"
    11  )
    12  
    13  // ID filters vertices based on their ID field.
    14  func ID(id int) predicate.Event {
    15  	return predicate.Event(func(s *sql.Selector) {
    16  		s.Where(sql.EQ(s.C(FieldID), id))
    17  	})
    18  }
    19  
    20  // IDEQ applies the EQ predicate on the ID field.
    21  func IDEQ(id int) predicate.Event {
    22  	return predicate.Event(func(s *sql.Selector) {
    23  		s.Where(sql.EQ(s.C(FieldID), id))
    24  	})
    25  }
    26  
    27  // IDNEQ applies the NEQ predicate on the ID field.
    28  func IDNEQ(id int) predicate.Event {
    29  	return predicate.Event(func(s *sql.Selector) {
    30  		s.Where(sql.NEQ(s.C(FieldID), id))
    31  	})
    32  }
    33  
    34  // IDIn applies the In predicate on the ID field.
    35  func IDIn(ids ...int) predicate.Event {
    36  	return predicate.Event(func(s *sql.Selector) {
    37  		// if not arguments were provided, append the FALSE constants,
    38  		// since we can't apply "IN ()". This will make this predicate falsy.
    39  		if len(ids) == 0 {
    40  			s.Where(sql.False())
    41  			return
    42  		}
    43  		v := make([]interface{}, len(ids))
    44  		for i := range v {
    45  			v[i] = ids[i]
    46  		}
    47  		s.Where(sql.In(s.C(FieldID), v...))
    48  	})
    49  }
    50  
    51  // IDNotIn applies the NotIn predicate on the ID field.
    52  func IDNotIn(ids ...int) predicate.Event {
    53  	return predicate.Event(func(s *sql.Selector) {
    54  		// if not arguments were provided, append the FALSE constants,
    55  		// since we can't apply "IN ()". This will make this predicate falsy.
    56  		if len(ids) == 0 {
    57  			s.Where(sql.False())
    58  			return
    59  		}
    60  		v := make([]interface{}, len(ids))
    61  		for i := range v {
    62  			v[i] = ids[i]
    63  		}
    64  		s.Where(sql.NotIn(s.C(FieldID), v...))
    65  	})
    66  }
    67  
    68  // IDGT applies the GT predicate on the ID field.
    69  func IDGT(id int) predicate.Event {
    70  	return predicate.Event(func(s *sql.Selector) {
    71  		s.Where(sql.GT(s.C(FieldID), id))
    72  	})
    73  }
    74  
    75  // IDGTE applies the GTE predicate on the ID field.
    76  func IDGTE(id int) predicate.Event {
    77  	return predicate.Event(func(s *sql.Selector) {
    78  		s.Where(sql.GTE(s.C(FieldID), id))
    79  	})
    80  }
    81  
    82  // IDLT applies the LT predicate on the ID field.
    83  func IDLT(id int) predicate.Event {
    84  	return predicate.Event(func(s *sql.Selector) {
    85  		s.Where(sql.LT(s.C(FieldID), id))
    86  	})
    87  }
    88  
    89  // IDLTE applies the LTE predicate on the ID field.
    90  func IDLTE(id int) predicate.Event {
    91  	return predicate.Event(func(s *sql.Selector) {
    92  		s.Where(sql.LTE(s.C(FieldID), id))
    93  	})
    94  }
    95  
    96  // CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
    97  func CreatedAt(v time.Time) predicate.Event {
    98  	return predicate.Event(func(s *sql.Selector) {
    99  		s.Where(sql.EQ(s.C(FieldCreatedAt), v))
   100  	})
   101  }
   102  
   103  // UpdatedAt applies equality check predicate on the "updated_at" field. It's identical to UpdatedAtEQ.
   104  func UpdatedAt(v time.Time) predicate.Event {
   105  	return predicate.Event(func(s *sql.Selector) {
   106  		s.Where(sql.EQ(s.C(FieldUpdatedAt), v))
   107  	})
   108  }
   109  
   110  // Time applies equality check predicate on the "time" field. It's identical to TimeEQ.
   111  func Time(v time.Time) predicate.Event {
   112  	return predicate.Event(func(s *sql.Selector) {
   113  		s.Where(sql.EQ(s.C(FieldTime), v))
   114  	})
   115  }
   116  
   117  // Serialized applies equality check predicate on the "serialized" field. It's identical to SerializedEQ.
   118  func Serialized(v string) predicate.Event {
   119  	return predicate.Event(func(s *sql.Selector) {
   120  		s.Where(sql.EQ(s.C(FieldSerialized), v))
   121  	})
   122  }
   123  
   124  // CreatedAtEQ applies the EQ predicate on the "created_at" field.
   125  func CreatedAtEQ(v time.Time) predicate.Event {
   126  	return predicate.Event(func(s *sql.Selector) {
   127  		s.Where(sql.EQ(s.C(FieldCreatedAt), v))
   128  	})
   129  }
   130  
   131  // CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
   132  func CreatedAtNEQ(v time.Time) predicate.Event {
   133  	return predicate.Event(func(s *sql.Selector) {
   134  		s.Where(sql.NEQ(s.C(FieldCreatedAt), v))
   135  	})
   136  }
   137  
   138  // CreatedAtIn applies the In predicate on the "created_at" field.
   139  func CreatedAtIn(vs ...time.Time) predicate.Event {
   140  	v := make([]interface{}, len(vs))
   141  	for i := range v {
   142  		v[i] = vs[i]
   143  	}
   144  	return predicate.Event(func(s *sql.Selector) {
   145  		// if not arguments were provided, append the FALSE constants,
   146  		// since we can't apply "IN ()". This will make this predicate falsy.
   147  		if len(v) == 0 {
   148  			s.Where(sql.False())
   149  			return
   150  		}
   151  		s.Where(sql.In(s.C(FieldCreatedAt), v...))
   152  	})
   153  }
   154  
   155  // CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
   156  func CreatedAtNotIn(vs ...time.Time) predicate.Event {
   157  	v := make([]interface{}, len(vs))
   158  	for i := range v {
   159  		v[i] = vs[i]
   160  	}
   161  	return predicate.Event(func(s *sql.Selector) {
   162  		// if not arguments were provided, append the FALSE constants,
   163  		// since we can't apply "IN ()". This will make this predicate falsy.
   164  		if len(v) == 0 {
   165  			s.Where(sql.False())
   166  			return
   167  		}
   168  		s.Where(sql.NotIn(s.C(FieldCreatedAt), v...))
   169  	})
   170  }
   171  
   172  // CreatedAtGT applies the GT predicate on the "created_at" field.
   173  func CreatedAtGT(v time.Time) predicate.Event {
   174  	return predicate.Event(func(s *sql.Selector) {
   175  		s.Where(sql.GT(s.C(FieldCreatedAt), v))
   176  	})
   177  }
   178  
   179  // CreatedAtGTE applies the GTE predicate on the "created_at" field.
   180  func CreatedAtGTE(v time.Time) predicate.Event {
   181  	return predicate.Event(func(s *sql.Selector) {
   182  		s.Where(sql.GTE(s.C(FieldCreatedAt), v))
   183  	})
   184  }
   185  
   186  // CreatedAtLT applies the LT predicate on the "created_at" field.
   187  func CreatedAtLT(v time.Time) predicate.Event {
   188  	return predicate.Event(func(s *sql.Selector) {
   189  		s.Where(sql.LT(s.C(FieldCreatedAt), v))
   190  	})
   191  }
   192  
   193  // CreatedAtLTE applies the LTE predicate on the "created_at" field.
   194  func CreatedAtLTE(v time.Time) predicate.Event {
   195  	return predicate.Event(func(s *sql.Selector) {
   196  		s.Where(sql.LTE(s.C(FieldCreatedAt), v))
   197  	})
   198  }
   199  
   200  // UpdatedAtEQ applies the EQ predicate on the "updated_at" field.
   201  func UpdatedAtEQ(v time.Time) predicate.Event {
   202  	return predicate.Event(func(s *sql.Selector) {
   203  		s.Where(sql.EQ(s.C(FieldUpdatedAt), v))
   204  	})
   205  }
   206  
   207  // UpdatedAtNEQ applies the NEQ predicate on the "updated_at" field.
   208  func UpdatedAtNEQ(v time.Time) predicate.Event {
   209  	return predicate.Event(func(s *sql.Selector) {
   210  		s.Where(sql.NEQ(s.C(FieldUpdatedAt), v))
   211  	})
   212  }
   213  
   214  // UpdatedAtIn applies the In predicate on the "updated_at" field.
   215  func UpdatedAtIn(vs ...time.Time) predicate.Event {
   216  	v := make([]interface{}, len(vs))
   217  	for i := range v {
   218  		v[i] = vs[i]
   219  	}
   220  	return predicate.Event(func(s *sql.Selector) {
   221  		// if not arguments were provided, append the FALSE constants,
   222  		// since we can't apply "IN ()". This will make this predicate falsy.
   223  		if len(v) == 0 {
   224  			s.Where(sql.False())
   225  			return
   226  		}
   227  		s.Where(sql.In(s.C(FieldUpdatedAt), v...))
   228  	})
   229  }
   230  
   231  // UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
   232  func UpdatedAtNotIn(vs ...time.Time) predicate.Event {
   233  	v := make([]interface{}, len(vs))
   234  	for i := range v {
   235  		v[i] = vs[i]
   236  	}
   237  	return predicate.Event(func(s *sql.Selector) {
   238  		// if not arguments were provided, append the FALSE constants,
   239  		// since we can't apply "IN ()". This will make this predicate falsy.
   240  		if len(v) == 0 {
   241  			s.Where(sql.False())
   242  			return
   243  		}
   244  		s.Where(sql.NotIn(s.C(FieldUpdatedAt), v...))
   245  	})
   246  }
   247  
   248  // UpdatedAtGT applies the GT predicate on the "updated_at" field.
   249  func UpdatedAtGT(v time.Time) predicate.Event {
   250  	return predicate.Event(func(s *sql.Selector) {
   251  		s.Where(sql.GT(s.C(FieldUpdatedAt), v))
   252  	})
   253  }
   254  
   255  // UpdatedAtGTE applies the GTE predicate on the "updated_at" field.
   256  func UpdatedAtGTE(v time.Time) predicate.Event {
   257  	return predicate.Event(func(s *sql.Selector) {
   258  		s.Where(sql.GTE(s.C(FieldUpdatedAt), v))
   259  	})
   260  }
   261  
   262  // UpdatedAtLT applies the LT predicate on the "updated_at" field.
   263  func UpdatedAtLT(v time.Time) predicate.Event {
   264  	return predicate.Event(func(s *sql.Selector) {
   265  		s.Where(sql.LT(s.C(FieldUpdatedAt), v))
   266  	})
   267  }
   268  
   269  // UpdatedAtLTE applies the LTE predicate on the "updated_at" field.
   270  func UpdatedAtLTE(v time.Time) predicate.Event {
   271  	return predicate.Event(func(s *sql.Selector) {
   272  		s.Where(sql.LTE(s.C(FieldUpdatedAt), v))
   273  	})
   274  }
   275  
   276  // TimeEQ applies the EQ predicate on the "time" field.
   277  func TimeEQ(v time.Time) predicate.Event {
   278  	return predicate.Event(func(s *sql.Selector) {
   279  		s.Where(sql.EQ(s.C(FieldTime), v))
   280  	})
   281  }
   282  
   283  // TimeNEQ applies the NEQ predicate on the "time" field.
   284  func TimeNEQ(v time.Time) predicate.Event {
   285  	return predicate.Event(func(s *sql.Selector) {
   286  		s.Where(sql.NEQ(s.C(FieldTime), v))
   287  	})
   288  }
   289  
   290  // TimeIn applies the In predicate on the "time" field.
   291  func TimeIn(vs ...time.Time) predicate.Event {
   292  	v := make([]interface{}, len(vs))
   293  	for i := range v {
   294  		v[i] = vs[i]
   295  	}
   296  	return predicate.Event(func(s *sql.Selector) {
   297  		// if not arguments were provided, append the FALSE constants,
   298  		// since we can't apply "IN ()". This will make this predicate falsy.
   299  		if len(v) == 0 {
   300  			s.Where(sql.False())
   301  			return
   302  		}
   303  		s.Where(sql.In(s.C(FieldTime), v...))
   304  	})
   305  }
   306  
   307  // TimeNotIn applies the NotIn predicate on the "time" field.
   308  func TimeNotIn(vs ...time.Time) predicate.Event {
   309  	v := make([]interface{}, len(vs))
   310  	for i := range v {
   311  		v[i] = vs[i]
   312  	}
   313  	return predicate.Event(func(s *sql.Selector) {
   314  		// if not arguments were provided, append the FALSE constants,
   315  		// since we can't apply "IN ()". This will make this predicate falsy.
   316  		if len(v) == 0 {
   317  			s.Where(sql.False())
   318  			return
   319  		}
   320  		s.Where(sql.NotIn(s.C(FieldTime), v...))
   321  	})
   322  }
   323  
   324  // TimeGT applies the GT predicate on the "time" field.
   325  func TimeGT(v time.Time) predicate.Event {
   326  	return predicate.Event(func(s *sql.Selector) {
   327  		s.Where(sql.GT(s.C(FieldTime), v))
   328  	})
   329  }
   330  
   331  // TimeGTE applies the GTE predicate on the "time" field.
   332  func TimeGTE(v time.Time) predicate.Event {
   333  	return predicate.Event(func(s *sql.Selector) {
   334  		s.Where(sql.GTE(s.C(FieldTime), v))
   335  	})
   336  }
   337  
   338  // TimeLT applies the LT predicate on the "time" field.
   339  func TimeLT(v time.Time) predicate.Event {
   340  	return predicate.Event(func(s *sql.Selector) {
   341  		s.Where(sql.LT(s.C(FieldTime), v))
   342  	})
   343  }
   344  
   345  // TimeLTE applies the LTE predicate on the "time" field.
   346  func TimeLTE(v time.Time) predicate.Event {
   347  	return predicate.Event(func(s *sql.Selector) {
   348  		s.Where(sql.LTE(s.C(FieldTime), v))
   349  	})
   350  }
   351  
   352  // SerializedEQ applies the EQ predicate on the "serialized" field.
   353  func SerializedEQ(v string) predicate.Event {
   354  	return predicate.Event(func(s *sql.Selector) {
   355  		s.Where(sql.EQ(s.C(FieldSerialized), v))
   356  	})
   357  }
   358  
   359  // SerializedNEQ applies the NEQ predicate on the "serialized" field.
   360  func SerializedNEQ(v string) predicate.Event {
   361  	return predicate.Event(func(s *sql.Selector) {
   362  		s.Where(sql.NEQ(s.C(FieldSerialized), v))
   363  	})
   364  }
   365  
   366  // SerializedIn applies the In predicate on the "serialized" field.
   367  func SerializedIn(vs ...string) predicate.Event {
   368  	v := make([]interface{}, len(vs))
   369  	for i := range v {
   370  		v[i] = vs[i]
   371  	}
   372  	return predicate.Event(func(s *sql.Selector) {
   373  		// if not arguments were provided, append the FALSE constants,
   374  		// since we can't apply "IN ()". This will make this predicate falsy.
   375  		if len(v) == 0 {
   376  			s.Where(sql.False())
   377  			return
   378  		}
   379  		s.Where(sql.In(s.C(FieldSerialized), v...))
   380  	})
   381  }
   382  
   383  // SerializedNotIn applies the NotIn predicate on the "serialized" field.
   384  func SerializedNotIn(vs ...string) predicate.Event {
   385  	v := make([]interface{}, len(vs))
   386  	for i := range v {
   387  		v[i] = vs[i]
   388  	}
   389  	return predicate.Event(func(s *sql.Selector) {
   390  		// if not arguments were provided, append the FALSE constants,
   391  		// since we can't apply "IN ()". This will make this predicate falsy.
   392  		if len(v) == 0 {
   393  			s.Where(sql.False())
   394  			return
   395  		}
   396  		s.Where(sql.NotIn(s.C(FieldSerialized), v...))
   397  	})
   398  }
   399  
   400  // SerializedGT applies the GT predicate on the "serialized" field.
   401  func SerializedGT(v string) predicate.Event {
   402  	return predicate.Event(func(s *sql.Selector) {
   403  		s.Where(sql.GT(s.C(FieldSerialized), v))
   404  	})
   405  }
   406  
   407  // SerializedGTE applies the GTE predicate on the "serialized" field.
   408  func SerializedGTE(v string) predicate.Event {
   409  	return predicate.Event(func(s *sql.Selector) {
   410  		s.Where(sql.GTE(s.C(FieldSerialized), v))
   411  	})
   412  }
   413  
   414  // SerializedLT applies the LT predicate on the "serialized" field.
   415  func SerializedLT(v string) predicate.Event {
   416  	return predicate.Event(func(s *sql.Selector) {
   417  		s.Where(sql.LT(s.C(FieldSerialized), v))
   418  	})
   419  }
   420  
   421  // SerializedLTE applies the LTE predicate on the "serialized" field.
   422  func SerializedLTE(v string) predicate.Event {
   423  	return predicate.Event(func(s *sql.Selector) {
   424  		s.Where(sql.LTE(s.C(FieldSerialized), v))
   425  	})
   426  }
   427  
   428  // SerializedContains applies the Contains predicate on the "serialized" field.
   429  func SerializedContains(v string) predicate.Event {
   430  	return predicate.Event(func(s *sql.Selector) {
   431  		s.Where(sql.Contains(s.C(FieldSerialized), v))
   432  	})
   433  }
   434  
   435  // SerializedHasPrefix applies the HasPrefix predicate on the "serialized" field.
   436  func SerializedHasPrefix(v string) predicate.Event {
   437  	return predicate.Event(func(s *sql.Selector) {
   438  		s.Where(sql.HasPrefix(s.C(FieldSerialized), v))
   439  	})
   440  }
   441  
   442  // SerializedHasSuffix applies the HasSuffix predicate on the "serialized" field.
   443  func SerializedHasSuffix(v string) predicate.Event {
   444  	return predicate.Event(func(s *sql.Selector) {
   445  		s.Where(sql.HasSuffix(s.C(FieldSerialized), v))
   446  	})
   447  }
   448  
   449  // SerializedEqualFold applies the EqualFold predicate on the "serialized" field.
   450  func SerializedEqualFold(v string) predicate.Event {
   451  	return predicate.Event(func(s *sql.Selector) {
   452  		s.Where(sql.EqualFold(s.C(FieldSerialized), v))
   453  	})
   454  }
   455  
   456  // SerializedContainsFold applies the ContainsFold predicate on the "serialized" field.
   457  func SerializedContainsFold(v string) predicate.Event {
   458  	return predicate.Event(func(s *sql.Selector) {
   459  		s.Where(sql.ContainsFold(s.C(FieldSerialized), v))
   460  	})
   461  }
   462  
   463  // HasOwner applies the HasEdge predicate on the "owner" edge.
   464  func HasOwner() predicate.Event {
   465  	return predicate.Event(func(s *sql.Selector) {
   466  		step := sqlgraph.NewStep(
   467  			sqlgraph.From(Table, FieldID),
   468  			sqlgraph.To(OwnerTable, FieldID),
   469  			sqlgraph.Edge(sqlgraph.M2O, true, OwnerTable, OwnerColumn),
   470  		)
   471  		sqlgraph.HasNeighbors(s, step)
   472  	})
   473  }
   474  
   475  // HasOwnerWith applies the HasEdge predicate on the "owner" edge with a given conditions (other predicates).
   476  func HasOwnerWith(preds ...predicate.Alert) predicate.Event {
   477  	return predicate.Event(func(s *sql.Selector) {
   478  		step := sqlgraph.NewStep(
   479  			sqlgraph.From(Table, FieldID),
   480  			sqlgraph.To(OwnerInverseTable, FieldID),
   481  			sqlgraph.Edge(sqlgraph.M2O, true, OwnerTable, OwnerColumn),
   482  		)
   483  		sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
   484  			for _, p := range preds {
   485  				p(s)
   486  			}
   487  		})
   488  	})
   489  }
   490  
   491  // And groups predicates with the AND operator between them.
   492  func And(predicates ...predicate.Event) predicate.Event {
   493  	return predicate.Event(func(s *sql.Selector) {
   494  		s1 := s.Clone().SetP(nil)
   495  		for _, p := range predicates {
   496  			p(s1)
   497  		}
   498  		s.Where(s1.P())
   499  	})
   500  }
   501  
   502  // Or groups predicates with the OR operator between them.
   503  func Or(predicates ...predicate.Event) predicate.Event {
   504  	return predicate.Event(func(s *sql.Selector) {
   505  		s1 := s.Clone().SetP(nil)
   506  		for i, p := range predicates {
   507  			if i > 0 {
   508  				s1.Or()
   509  			}
   510  			p(s1)
   511  		}
   512  		s.Where(s1.P())
   513  	})
   514  }
   515  
   516  // Not applies the not operator on the given predicate.
   517  func Not(p predicate.Event) predicate.Event {
   518  	return predicate.Event(func(s *sql.Selector) {
   519  		p(s.Not())
   520  	})
   521  }