github.com/crowdsecurity/crowdsec@v1.6.1/pkg/database/ent/event/event.go (about) 1 // Code generated by ent, 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 ) 11 12 const ( 13 // Label holds the string label denoting the event type in the database. 14 Label = "event" 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 // FieldTime holds the string denoting the time field in the database. 22 FieldTime = "time" 23 // FieldSerialized holds the string denoting the serialized field in the database. 24 FieldSerialized = "serialized" 25 // FieldAlertEvents holds the string denoting the alert_events field in the database. 26 FieldAlertEvents = "alert_events" 27 // EdgeOwner holds the string denoting the owner edge name in mutations. 28 EdgeOwner = "owner" 29 // Table holds the table name of the event in the database. 30 Table = "events" 31 // OwnerTable is the table that holds the owner relation/edge. 32 OwnerTable = "events" 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_events" 38 ) 39 40 // Columns holds all SQL columns for event fields. 41 var Columns = []string{ 42 FieldID, 43 FieldCreatedAt, 44 FieldUpdatedAt, 45 FieldTime, 46 FieldSerialized, 47 FieldAlertEvents, 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 // SerializedValidator is a validator for the "serialized" field. It is called by the builders before save. 70 SerializedValidator func(string) error 71 ) 72 73 // OrderOption defines the ordering options for the Event 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 // ByTime orders the results by the time field. 92 func ByTime(opts ...sql.OrderTermOption) OrderOption { 93 return sql.OrderByField(FieldTime, opts...).ToFunc() 94 } 95 96 // BySerialized orders the results by the serialized field. 97 func BySerialized(opts ...sql.OrderTermOption) OrderOption { 98 return sql.OrderByField(FieldSerialized, opts...).ToFunc() 99 } 100 101 // ByAlertEvents orders the results by the alert_events field. 102 func ByAlertEvents(opts ...sql.OrderTermOption) OrderOption { 103 return sql.OrderByField(FieldAlertEvents, 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 }