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