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

     1  // Code generated by entc, DO NOT EDIT.
     2  
     3  package meta
     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.Meta {
    15  	return predicate.Meta(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.Meta {
    22  	return predicate.Meta(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.Meta {
    29  	return predicate.Meta(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.Meta {
    36  	return predicate.Meta(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.Meta {
    53  	return predicate.Meta(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.Meta {
    70  	return predicate.Meta(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.Meta {
    77  	return predicate.Meta(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.Meta {
    84  	return predicate.Meta(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.Meta {
    91  	return predicate.Meta(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.Meta {
    98  	return predicate.Meta(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.Meta {
   105  	return predicate.Meta(func(s *sql.Selector) {
   106  		s.Where(sql.EQ(s.C(FieldUpdatedAt), v))
   107  	})
   108  }
   109  
   110  // Key applies equality check predicate on the "key" field. It's identical to KeyEQ.
   111  func Key(v string) predicate.Meta {
   112  	return predicate.Meta(func(s *sql.Selector) {
   113  		s.Where(sql.EQ(s.C(FieldKey), v))
   114  	})
   115  }
   116  
   117  // Value applies equality check predicate on the "value" field. It's identical to ValueEQ.
   118  func Value(v string) predicate.Meta {
   119  	return predicate.Meta(func(s *sql.Selector) {
   120  		s.Where(sql.EQ(s.C(FieldValue), v))
   121  	})
   122  }
   123  
   124  // CreatedAtEQ applies the EQ predicate on the "created_at" field.
   125  func CreatedAtEQ(v time.Time) predicate.Meta {
   126  	return predicate.Meta(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.Meta {
   133  	return predicate.Meta(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.Meta {
   140  	v := make([]interface{}, len(vs))
   141  	for i := range v {
   142  		v[i] = vs[i]
   143  	}
   144  	return predicate.Meta(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.Meta {
   157  	v := make([]interface{}, len(vs))
   158  	for i := range v {
   159  		v[i] = vs[i]
   160  	}
   161  	return predicate.Meta(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.Meta {
   174  	return predicate.Meta(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.Meta {
   181  	return predicate.Meta(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.Meta {
   188  	return predicate.Meta(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.Meta {
   195  	return predicate.Meta(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.Meta {
   202  	return predicate.Meta(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.Meta {
   209  	return predicate.Meta(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.Meta {
   216  	v := make([]interface{}, len(vs))
   217  	for i := range v {
   218  		v[i] = vs[i]
   219  	}
   220  	return predicate.Meta(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.Meta {
   233  	v := make([]interface{}, len(vs))
   234  	for i := range v {
   235  		v[i] = vs[i]
   236  	}
   237  	return predicate.Meta(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.Meta {
   250  	return predicate.Meta(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.Meta {
   257  	return predicate.Meta(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.Meta {
   264  	return predicate.Meta(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.Meta {
   271  	return predicate.Meta(func(s *sql.Selector) {
   272  		s.Where(sql.LTE(s.C(FieldUpdatedAt), v))
   273  	})
   274  }
   275  
   276  // KeyEQ applies the EQ predicate on the "key" field.
   277  func KeyEQ(v string) predicate.Meta {
   278  	return predicate.Meta(func(s *sql.Selector) {
   279  		s.Where(sql.EQ(s.C(FieldKey), v))
   280  	})
   281  }
   282  
   283  // KeyNEQ applies the NEQ predicate on the "key" field.
   284  func KeyNEQ(v string) predicate.Meta {
   285  	return predicate.Meta(func(s *sql.Selector) {
   286  		s.Where(sql.NEQ(s.C(FieldKey), v))
   287  	})
   288  }
   289  
   290  // KeyIn applies the In predicate on the "key" field.
   291  func KeyIn(vs ...string) predicate.Meta {
   292  	v := make([]interface{}, len(vs))
   293  	for i := range v {
   294  		v[i] = vs[i]
   295  	}
   296  	return predicate.Meta(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(FieldKey), v...))
   304  	})
   305  }
   306  
   307  // KeyNotIn applies the NotIn predicate on the "key" field.
   308  func KeyNotIn(vs ...string) predicate.Meta {
   309  	v := make([]interface{}, len(vs))
   310  	for i := range v {
   311  		v[i] = vs[i]
   312  	}
   313  	return predicate.Meta(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(FieldKey), v...))
   321  	})
   322  }
   323  
   324  // KeyGT applies the GT predicate on the "key" field.
   325  func KeyGT(v string) predicate.Meta {
   326  	return predicate.Meta(func(s *sql.Selector) {
   327  		s.Where(sql.GT(s.C(FieldKey), v))
   328  	})
   329  }
   330  
   331  // KeyGTE applies the GTE predicate on the "key" field.
   332  func KeyGTE(v string) predicate.Meta {
   333  	return predicate.Meta(func(s *sql.Selector) {
   334  		s.Where(sql.GTE(s.C(FieldKey), v))
   335  	})
   336  }
   337  
   338  // KeyLT applies the LT predicate on the "key" field.
   339  func KeyLT(v string) predicate.Meta {
   340  	return predicate.Meta(func(s *sql.Selector) {
   341  		s.Where(sql.LT(s.C(FieldKey), v))
   342  	})
   343  }
   344  
   345  // KeyLTE applies the LTE predicate on the "key" field.
   346  func KeyLTE(v string) predicate.Meta {
   347  	return predicate.Meta(func(s *sql.Selector) {
   348  		s.Where(sql.LTE(s.C(FieldKey), v))
   349  	})
   350  }
   351  
   352  // KeyContains applies the Contains predicate on the "key" field.
   353  func KeyContains(v string) predicate.Meta {
   354  	return predicate.Meta(func(s *sql.Selector) {
   355  		s.Where(sql.Contains(s.C(FieldKey), v))
   356  	})
   357  }
   358  
   359  // KeyHasPrefix applies the HasPrefix predicate on the "key" field.
   360  func KeyHasPrefix(v string) predicate.Meta {
   361  	return predicate.Meta(func(s *sql.Selector) {
   362  		s.Where(sql.HasPrefix(s.C(FieldKey), v))
   363  	})
   364  }
   365  
   366  // KeyHasSuffix applies the HasSuffix predicate on the "key" field.
   367  func KeyHasSuffix(v string) predicate.Meta {
   368  	return predicate.Meta(func(s *sql.Selector) {
   369  		s.Where(sql.HasSuffix(s.C(FieldKey), v))
   370  	})
   371  }
   372  
   373  // KeyEqualFold applies the EqualFold predicate on the "key" field.
   374  func KeyEqualFold(v string) predicate.Meta {
   375  	return predicate.Meta(func(s *sql.Selector) {
   376  		s.Where(sql.EqualFold(s.C(FieldKey), v))
   377  	})
   378  }
   379  
   380  // KeyContainsFold applies the ContainsFold predicate on the "key" field.
   381  func KeyContainsFold(v string) predicate.Meta {
   382  	return predicate.Meta(func(s *sql.Selector) {
   383  		s.Where(sql.ContainsFold(s.C(FieldKey), v))
   384  	})
   385  }
   386  
   387  // ValueEQ applies the EQ predicate on the "value" field.
   388  func ValueEQ(v string) predicate.Meta {
   389  	return predicate.Meta(func(s *sql.Selector) {
   390  		s.Where(sql.EQ(s.C(FieldValue), v))
   391  	})
   392  }
   393  
   394  // ValueNEQ applies the NEQ predicate on the "value" field.
   395  func ValueNEQ(v string) predicate.Meta {
   396  	return predicate.Meta(func(s *sql.Selector) {
   397  		s.Where(sql.NEQ(s.C(FieldValue), v))
   398  	})
   399  }
   400  
   401  // ValueIn applies the In predicate on the "value" field.
   402  func ValueIn(vs ...string) predicate.Meta {
   403  	v := make([]interface{}, len(vs))
   404  	for i := range v {
   405  		v[i] = vs[i]
   406  	}
   407  	return predicate.Meta(func(s *sql.Selector) {
   408  		// if not arguments were provided, append the FALSE constants,
   409  		// since we can't apply "IN ()". This will make this predicate falsy.
   410  		if len(v) == 0 {
   411  			s.Where(sql.False())
   412  			return
   413  		}
   414  		s.Where(sql.In(s.C(FieldValue), v...))
   415  	})
   416  }
   417  
   418  // ValueNotIn applies the NotIn predicate on the "value" field.
   419  func ValueNotIn(vs ...string) predicate.Meta {
   420  	v := make([]interface{}, len(vs))
   421  	for i := range v {
   422  		v[i] = vs[i]
   423  	}
   424  	return predicate.Meta(func(s *sql.Selector) {
   425  		// if not arguments were provided, append the FALSE constants,
   426  		// since we can't apply "IN ()". This will make this predicate falsy.
   427  		if len(v) == 0 {
   428  			s.Where(sql.False())
   429  			return
   430  		}
   431  		s.Where(sql.NotIn(s.C(FieldValue), v...))
   432  	})
   433  }
   434  
   435  // ValueGT applies the GT predicate on the "value" field.
   436  func ValueGT(v string) predicate.Meta {
   437  	return predicate.Meta(func(s *sql.Selector) {
   438  		s.Where(sql.GT(s.C(FieldValue), v))
   439  	})
   440  }
   441  
   442  // ValueGTE applies the GTE predicate on the "value" field.
   443  func ValueGTE(v string) predicate.Meta {
   444  	return predicate.Meta(func(s *sql.Selector) {
   445  		s.Where(sql.GTE(s.C(FieldValue), v))
   446  	})
   447  }
   448  
   449  // ValueLT applies the LT predicate on the "value" field.
   450  func ValueLT(v string) predicate.Meta {
   451  	return predicate.Meta(func(s *sql.Selector) {
   452  		s.Where(sql.LT(s.C(FieldValue), v))
   453  	})
   454  }
   455  
   456  // ValueLTE applies the LTE predicate on the "value" field.
   457  func ValueLTE(v string) predicate.Meta {
   458  	return predicate.Meta(func(s *sql.Selector) {
   459  		s.Where(sql.LTE(s.C(FieldValue), v))
   460  	})
   461  }
   462  
   463  // ValueContains applies the Contains predicate on the "value" field.
   464  func ValueContains(v string) predicate.Meta {
   465  	return predicate.Meta(func(s *sql.Selector) {
   466  		s.Where(sql.Contains(s.C(FieldValue), v))
   467  	})
   468  }
   469  
   470  // ValueHasPrefix applies the HasPrefix predicate on the "value" field.
   471  func ValueHasPrefix(v string) predicate.Meta {
   472  	return predicate.Meta(func(s *sql.Selector) {
   473  		s.Where(sql.HasPrefix(s.C(FieldValue), v))
   474  	})
   475  }
   476  
   477  // ValueHasSuffix applies the HasSuffix predicate on the "value" field.
   478  func ValueHasSuffix(v string) predicate.Meta {
   479  	return predicate.Meta(func(s *sql.Selector) {
   480  		s.Where(sql.HasSuffix(s.C(FieldValue), v))
   481  	})
   482  }
   483  
   484  // ValueEqualFold applies the EqualFold predicate on the "value" field.
   485  func ValueEqualFold(v string) predicate.Meta {
   486  	return predicate.Meta(func(s *sql.Selector) {
   487  		s.Where(sql.EqualFold(s.C(FieldValue), v))
   488  	})
   489  }
   490  
   491  // ValueContainsFold applies the ContainsFold predicate on the "value" field.
   492  func ValueContainsFold(v string) predicate.Meta {
   493  	return predicate.Meta(func(s *sql.Selector) {
   494  		s.Where(sql.ContainsFold(s.C(FieldValue), v))
   495  	})
   496  }
   497  
   498  // HasOwner applies the HasEdge predicate on the "owner" edge.
   499  func HasOwner() predicate.Meta {
   500  	return predicate.Meta(func(s *sql.Selector) {
   501  		step := sqlgraph.NewStep(
   502  			sqlgraph.From(Table, FieldID),
   503  			sqlgraph.To(OwnerTable, FieldID),
   504  			sqlgraph.Edge(sqlgraph.M2O, true, OwnerTable, OwnerColumn),
   505  		)
   506  		sqlgraph.HasNeighbors(s, step)
   507  	})
   508  }
   509  
   510  // HasOwnerWith applies the HasEdge predicate on the "owner" edge with a given conditions (other predicates).
   511  func HasOwnerWith(preds ...predicate.Alert) predicate.Meta {
   512  	return predicate.Meta(func(s *sql.Selector) {
   513  		step := sqlgraph.NewStep(
   514  			sqlgraph.From(Table, FieldID),
   515  			sqlgraph.To(OwnerInverseTable, FieldID),
   516  			sqlgraph.Edge(sqlgraph.M2O, true, OwnerTable, OwnerColumn),
   517  		)
   518  		sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
   519  			for _, p := range preds {
   520  				p(s)
   521  			}
   522  		})
   523  	})
   524  }
   525  
   526  // And groups predicates with the AND operator between them.
   527  func And(predicates ...predicate.Meta) predicate.Meta {
   528  	return predicate.Meta(func(s *sql.Selector) {
   529  		s1 := s.Clone().SetP(nil)
   530  		for _, p := range predicates {
   531  			p(s1)
   532  		}
   533  		s.Where(s1.P())
   534  	})
   535  }
   536  
   537  // Or groups predicates with the OR operator between them.
   538  func Or(predicates ...predicate.Meta) predicate.Meta {
   539  	return predicate.Meta(func(s *sql.Selector) {
   540  		s1 := s.Clone().SetP(nil)
   541  		for i, p := range predicates {
   542  			if i > 0 {
   543  				s1.Or()
   544  			}
   545  			p(s1)
   546  		}
   547  		s.Where(s1.P())
   548  	})
   549  }
   550  
   551  // Not applies the not operator on the given predicate.
   552  func Not(p predicate.Meta) predicate.Meta {
   553  	return predicate.Meta(func(s *sql.Selector) {
   554  		p(s.Not())
   555  	})
   556  }