github.com/crowdsecurity/crowdsec@v1.6.1/pkg/database/ent/configitem/configitem.go (about) 1 // Code generated by ent, DO NOT EDIT. 2 3 package configitem 4 5 import ( 6 "time" 7 8 "entgo.io/ent/dialect/sql" 9 ) 10 11 const ( 12 // Label holds the string label denoting the configitem type in the database. 13 Label = "config_item" 14 // FieldID holds the string denoting the id field in the database. 15 FieldID = "id" 16 // FieldCreatedAt holds the string denoting the created_at field in the database. 17 FieldCreatedAt = "created_at" 18 // FieldUpdatedAt holds the string denoting the updated_at field in the database. 19 FieldUpdatedAt = "updated_at" 20 // FieldName holds the string denoting the name field in the database. 21 FieldName = "name" 22 // FieldValue holds the string denoting the value field in the database. 23 FieldValue = "value" 24 // Table holds the table name of the configitem in the database. 25 Table = "config_items" 26 ) 27 28 // Columns holds all SQL columns for configitem fields. 29 var Columns = []string{ 30 FieldID, 31 FieldCreatedAt, 32 FieldUpdatedAt, 33 FieldName, 34 FieldValue, 35 } 36 37 // ValidColumn reports if the column name is valid (part of the table columns). 38 func ValidColumn(column string) bool { 39 for i := range Columns { 40 if column == Columns[i] { 41 return true 42 } 43 } 44 return false 45 } 46 47 var ( 48 // DefaultCreatedAt holds the default value on creation for the "created_at" field. 49 DefaultCreatedAt func() time.Time 50 // UpdateDefaultCreatedAt holds the default value on update for the "created_at" field. 51 UpdateDefaultCreatedAt func() time.Time 52 // DefaultUpdatedAt holds the default value on creation for the "updated_at" field. 53 DefaultUpdatedAt func() time.Time 54 // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field. 55 UpdateDefaultUpdatedAt func() time.Time 56 ) 57 58 // OrderOption defines the ordering options for the ConfigItem queries. 59 type OrderOption func(*sql.Selector) 60 61 // ByID orders the results by the id field. 62 func ByID(opts ...sql.OrderTermOption) OrderOption { 63 return sql.OrderByField(FieldID, opts...).ToFunc() 64 } 65 66 // ByCreatedAt orders the results by the created_at field. 67 func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption { 68 return sql.OrderByField(FieldCreatedAt, opts...).ToFunc() 69 } 70 71 // ByUpdatedAt orders the results by the updated_at field. 72 func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption { 73 return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc() 74 } 75 76 // ByName orders the results by the name field. 77 func ByName(opts ...sql.OrderTermOption) OrderOption { 78 return sql.OrderByField(FieldName, opts...).ToFunc() 79 } 80 81 // ByValue orders the results by the value field. 82 func ByValue(opts ...sql.OrderTermOption) OrderOption { 83 return sql.OrderByField(FieldValue, opts...).ToFunc() 84 }