github.com/crowdsecurity/crowdsec@v1.6.1/pkg/database/ent/decision/decision.go (about) 1 // Code generated by ent, DO NOT EDIT. 2 3 package decision 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 decision type in the database. 14 Label = "decision" 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 // FieldUntil holds the string denoting the until field in the database. 22 FieldUntil = "until" 23 // FieldScenario holds the string denoting the scenario field in the database. 24 FieldScenario = "scenario" 25 // FieldType holds the string denoting the type field in the database. 26 FieldType = "type" 27 // FieldStartIP holds the string denoting the start_ip field in the database. 28 FieldStartIP = "start_ip" 29 // FieldEndIP holds the string denoting the end_ip field in the database. 30 FieldEndIP = "end_ip" 31 // FieldStartSuffix holds the string denoting the start_suffix field in the database. 32 FieldStartSuffix = "start_suffix" 33 // FieldEndSuffix holds the string denoting the end_suffix field in the database. 34 FieldEndSuffix = "end_suffix" 35 // FieldIPSize holds the string denoting the ip_size field in the database. 36 FieldIPSize = "ip_size" 37 // FieldScope holds the string denoting the scope field in the database. 38 FieldScope = "scope" 39 // FieldValue holds the string denoting the value field in the database. 40 FieldValue = "value" 41 // FieldOrigin holds the string denoting the origin field in the database. 42 FieldOrigin = "origin" 43 // FieldSimulated holds the string denoting the simulated field in the database. 44 FieldSimulated = "simulated" 45 // FieldUUID holds the string denoting the uuid field in the database. 46 FieldUUID = "uuid" 47 // FieldAlertDecisions holds the string denoting the alert_decisions field in the database. 48 FieldAlertDecisions = "alert_decisions" 49 // EdgeOwner holds the string denoting the owner edge name in mutations. 50 EdgeOwner = "owner" 51 // Table holds the table name of the decision in the database. 52 Table = "decisions" 53 // OwnerTable is the table that holds the owner relation/edge. 54 OwnerTable = "decisions" 55 // OwnerInverseTable is the table name for the Alert entity. 56 // It exists in this package in order to avoid circular dependency with the "alert" package. 57 OwnerInverseTable = "alerts" 58 // OwnerColumn is the table column denoting the owner relation/edge. 59 OwnerColumn = "alert_decisions" 60 ) 61 62 // Columns holds all SQL columns for decision fields. 63 var Columns = []string{ 64 FieldID, 65 FieldCreatedAt, 66 FieldUpdatedAt, 67 FieldUntil, 68 FieldScenario, 69 FieldType, 70 FieldStartIP, 71 FieldEndIP, 72 FieldStartSuffix, 73 FieldEndSuffix, 74 FieldIPSize, 75 FieldScope, 76 FieldValue, 77 FieldOrigin, 78 FieldSimulated, 79 FieldUUID, 80 FieldAlertDecisions, 81 } 82 83 // ValidColumn reports if the column name is valid (part of the table columns). 84 func ValidColumn(column string) bool { 85 for i := range Columns { 86 if column == Columns[i] { 87 return true 88 } 89 } 90 return false 91 } 92 93 var ( 94 // DefaultCreatedAt holds the default value on creation for the "created_at" field. 95 DefaultCreatedAt func() time.Time 96 // UpdateDefaultCreatedAt holds the default value on update for the "created_at" field. 97 UpdateDefaultCreatedAt func() time.Time 98 // DefaultUpdatedAt holds the default value on creation for the "updated_at" field. 99 DefaultUpdatedAt func() time.Time 100 // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field. 101 UpdateDefaultUpdatedAt func() time.Time 102 // DefaultSimulated holds the default value on creation for the "simulated" field. 103 DefaultSimulated bool 104 ) 105 106 // OrderOption defines the ordering options for the Decision queries. 107 type OrderOption func(*sql.Selector) 108 109 // ByID orders the results by the id field. 110 func ByID(opts ...sql.OrderTermOption) OrderOption { 111 return sql.OrderByField(FieldID, opts...).ToFunc() 112 } 113 114 // ByCreatedAt orders the results by the created_at field. 115 func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption { 116 return sql.OrderByField(FieldCreatedAt, opts...).ToFunc() 117 } 118 119 // ByUpdatedAt orders the results by the updated_at field. 120 func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption { 121 return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc() 122 } 123 124 // ByUntil orders the results by the until field. 125 func ByUntil(opts ...sql.OrderTermOption) OrderOption { 126 return sql.OrderByField(FieldUntil, opts...).ToFunc() 127 } 128 129 // ByScenario orders the results by the scenario field. 130 func ByScenario(opts ...sql.OrderTermOption) OrderOption { 131 return sql.OrderByField(FieldScenario, opts...).ToFunc() 132 } 133 134 // ByType orders the results by the type field. 135 func ByType(opts ...sql.OrderTermOption) OrderOption { 136 return sql.OrderByField(FieldType, opts...).ToFunc() 137 } 138 139 // ByStartIP orders the results by the start_ip field. 140 func ByStartIP(opts ...sql.OrderTermOption) OrderOption { 141 return sql.OrderByField(FieldStartIP, opts...).ToFunc() 142 } 143 144 // ByEndIP orders the results by the end_ip field. 145 func ByEndIP(opts ...sql.OrderTermOption) OrderOption { 146 return sql.OrderByField(FieldEndIP, opts...).ToFunc() 147 } 148 149 // ByStartSuffix orders the results by the start_suffix field. 150 func ByStartSuffix(opts ...sql.OrderTermOption) OrderOption { 151 return sql.OrderByField(FieldStartSuffix, opts...).ToFunc() 152 } 153 154 // ByEndSuffix orders the results by the end_suffix field. 155 func ByEndSuffix(opts ...sql.OrderTermOption) OrderOption { 156 return sql.OrderByField(FieldEndSuffix, opts...).ToFunc() 157 } 158 159 // ByIPSize orders the results by the ip_size field. 160 func ByIPSize(opts ...sql.OrderTermOption) OrderOption { 161 return sql.OrderByField(FieldIPSize, opts...).ToFunc() 162 } 163 164 // ByScope orders the results by the scope field. 165 func ByScope(opts ...sql.OrderTermOption) OrderOption { 166 return sql.OrderByField(FieldScope, opts...).ToFunc() 167 } 168 169 // ByValue orders the results by the value field. 170 func ByValue(opts ...sql.OrderTermOption) OrderOption { 171 return sql.OrderByField(FieldValue, opts...).ToFunc() 172 } 173 174 // ByOrigin orders the results by the origin field. 175 func ByOrigin(opts ...sql.OrderTermOption) OrderOption { 176 return sql.OrderByField(FieldOrigin, opts...).ToFunc() 177 } 178 179 // BySimulated orders the results by the simulated field. 180 func BySimulated(opts ...sql.OrderTermOption) OrderOption { 181 return sql.OrderByField(FieldSimulated, opts...).ToFunc() 182 } 183 184 // ByUUID orders the results by the uuid field. 185 func ByUUID(opts ...sql.OrderTermOption) OrderOption { 186 return sql.OrderByField(FieldUUID, opts...).ToFunc() 187 } 188 189 // ByAlertDecisions orders the results by the alert_decisions field. 190 func ByAlertDecisions(opts ...sql.OrderTermOption) OrderOption { 191 return sql.OrderByField(FieldAlertDecisions, opts...).ToFunc() 192 } 193 194 // ByOwnerField orders the results by owner field. 195 func ByOwnerField(field string, opts ...sql.OrderTermOption) OrderOption { 196 return func(s *sql.Selector) { 197 sqlgraph.OrderByNeighborTerms(s, newOwnerStep(), sql.OrderByField(field, opts...)) 198 } 199 } 200 func newOwnerStep() *sqlgraph.Step { 201 return sqlgraph.NewStep( 202 sqlgraph.From(Table, FieldID), 203 sqlgraph.To(OwnerInverseTable, FieldID), 204 sqlgraph.Edge(sqlgraph.M2O, true, OwnerTable, OwnerColumn), 205 ) 206 }