github.com/crowdsecurity/crowdsec@v1.6.1/pkg/database/ent/meta/meta.go (about) 1 // Code generated by ent, 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 ) 11 12 const ( 13 // Label holds the string label denoting the meta type in the database. 14 Label = "meta" 15 // FieldID holds the string denoting the id field in the database. 16 FieldID = "id" 17 // FieldCreatedAt holds the string denoting the created_at field in the database. 18 FieldCreatedAt = "created_at" 19 // FieldUpdatedAt holds the string denoting the updated_at field in the database. 20 FieldUpdatedAt = "updated_at" 21 // FieldKey holds the string denoting the key field in the database. 22 FieldKey = "key" 23 // FieldValue holds the string denoting the value field in the database. 24 FieldValue = "value" 25 // FieldAlertMetas holds the string denoting the alert_metas field in the database. 26 FieldAlertMetas = "alert_metas" 27 // EdgeOwner holds the string denoting the owner edge name in mutations. 28 EdgeOwner = "owner" 29 // Table holds the table name of the meta in the database. 30 Table = "meta" 31 // OwnerTable is the table that holds the owner relation/edge. 32 OwnerTable = "meta" 33 // OwnerInverseTable is the table name for the Alert entity. 34 // It exists in this package in order to avoid circular dependency with the "alert" package. 35 OwnerInverseTable = "alerts" 36 // OwnerColumn is the table column denoting the owner relation/edge. 37 OwnerColumn = "alert_metas" 38 ) 39 40 // Columns holds all SQL columns for meta fields. 41 var Columns = []string{ 42 FieldID, 43 FieldCreatedAt, 44 FieldUpdatedAt, 45 FieldKey, 46 FieldValue, 47 FieldAlertMetas, 48 } 49 50 // ValidColumn reports if the column name is valid (part of the table columns). 51 func ValidColumn(column string) bool { 52 for i := range Columns { 53 if column == Columns[i] { 54 return true 55 } 56 } 57 return false 58 } 59 60 var ( 61 // DefaultCreatedAt holds the default value on creation for the "created_at" field. 62 DefaultCreatedAt func() time.Time 63 // UpdateDefaultCreatedAt holds the default value on update for the "created_at" field. 64 UpdateDefaultCreatedAt func() time.Time 65 // DefaultUpdatedAt holds the default value on creation for the "updated_at" field. 66 DefaultUpdatedAt func() time.Time 67 // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field. 68 UpdateDefaultUpdatedAt func() time.Time 69 // ValueValidator is a validator for the "value" field. It is called by the builders before save. 70 ValueValidator func(string) error 71 ) 72 73 // OrderOption defines the ordering options for the Meta queries. 74 type OrderOption func(*sql.Selector) 75 76 // ByID orders the results by the id field. 77 func ByID(opts ...sql.OrderTermOption) OrderOption { 78 return sql.OrderByField(FieldID, opts...).ToFunc() 79 } 80 81 // ByCreatedAt orders the results by the created_at field. 82 func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption { 83 return sql.OrderByField(FieldCreatedAt, opts...).ToFunc() 84 } 85 86 // ByUpdatedAt orders the results by the updated_at field. 87 func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption { 88 return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc() 89 } 90 91 // ByKey orders the results by the key field. 92 func ByKey(opts ...sql.OrderTermOption) OrderOption { 93 return sql.OrderByField(FieldKey, opts...).ToFunc() 94 } 95 96 // ByValue orders the results by the value field. 97 func ByValue(opts ...sql.OrderTermOption) OrderOption { 98 return sql.OrderByField(FieldValue, opts...).ToFunc() 99 } 100 101 // ByAlertMetas orders the results by the alert_metas field. 102 func ByAlertMetas(opts ...sql.OrderTermOption) OrderOption { 103 return sql.OrderByField(FieldAlertMetas, opts...).ToFunc() 104 } 105 106 // ByOwnerField orders the results by owner field. 107 func ByOwnerField(field string, opts ...sql.OrderTermOption) OrderOption { 108 return func(s *sql.Selector) { 109 sqlgraph.OrderByNeighborTerms(s, newOwnerStep(), sql.OrderByField(field, opts...)) 110 } 111 } 112 func newOwnerStep() *sqlgraph.Step { 113 return sqlgraph.NewStep( 114 sqlgraph.From(Table, FieldID), 115 sqlgraph.To(OwnerInverseTable, FieldID), 116 sqlgraph.Edge(sqlgraph.M2O, true, OwnerTable, OwnerColumn), 117 ) 118 }