github.com/iasthc/atlas/cmd/atlas@v0.0.0-20230523071841-73246df3f88d/internal/migrate/ent/revision/revision.go (about) 1 // Copyright 2021-present The Atlas Authors. All rights reserved. 2 // This source code is licensed under the Apache 2.0 license found 3 // in the LICENSE file in the root directory of this source tree. 4 5 // Code generated by entc, DO NOT EDIT. 6 7 package revision 8 9 import ( 10 "github.com/iasthc/atlas/sql/migrate" 11 "entgo.io/ent/dialect/sql" 12 ) 13 14 const ( 15 // Label holds the string label denoting the revision type in the database. 16 Label = "revision" 17 // FieldID holds the string denoting the id field in the database. 18 FieldID = "version" 19 // FieldDescription holds the string denoting the description field in the database. 20 FieldDescription = "description" 21 // FieldType holds the string denoting the type field in the database. 22 FieldType = "type" 23 // FieldApplied holds the string denoting the applied field in the database. 24 FieldApplied = "applied" 25 // FieldTotal holds the string denoting the total field in the database. 26 FieldTotal = "total" 27 // FieldExecutedAt holds the string denoting the executed_at field in the database. 28 FieldExecutedAt = "executed_at" 29 // FieldExecutionTime holds the string denoting the execution_time field in the database. 30 FieldExecutionTime = "execution_time" 31 // FieldError holds the string denoting the error field in the database. 32 FieldError = "error" 33 // FieldErrorStmt holds the string denoting the error_stmt field in the database. 34 FieldErrorStmt = "error_stmt" 35 // FieldHash holds the string denoting the hash field in the database. 36 FieldHash = "hash" 37 // FieldPartialHashes holds the string denoting the partial_hashes field in the database. 38 FieldPartialHashes = "partial_hashes" 39 // FieldOperatorVersion holds the string denoting the operator_version field in the database. 40 FieldOperatorVersion = "operator_version" 41 // Table holds the table name of the revision in the database. 42 Table = "atlas_schema_revisions" 43 ) 44 45 // Columns holds all SQL columns for revision fields. 46 var Columns = []string{ 47 FieldID, 48 FieldDescription, 49 FieldType, 50 FieldApplied, 51 FieldTotal, 52 FieldExecutedAt, 53 FieldExecutionTime, 54 FieldError, 55 FieldErrorStmt, 56 FieldHash, 57 FieldPartialHashes, 58 FieldOperatorVersion, 59 } 60 61 // ValidColumn reports if the column name is valid (part of the table columns). 62 func ValidColumn(column string) bool { 63 for i := range Columns { 64 if column == Columns[i] { 65 return true 66 } 67 } 68 return false 69 } 70 71 var ( 72 // DefaultType holds the default value on creation for the "type" field. 73 DefaultType migrate.RevisionType 74 // DefaultApplied holds the default value on creation for the "applied" field. 75 DefaultApplied int 76 // AppliedValidator is a validator for the "applied" field. It is called by the builders before save. 77 AppliedValidator func(int) error 78 // DefaultTotal holds the default value on creation for the "total" field. 79 DefaultTotal int 80 // TotalValidator is a validator for the "total" field. It is called by the builders before save. 81 TotalValidator func(int) error 82 ) 83 84 // OrderOption defines the ordering options for the Revision queries. 85 type OrderOption func(*sql.Selector) 86 87 // ByID orders the results by the id field. 88 func ByID(opts ...sql.OrderTermOption) OrderOption { 89 return sql.OrderByField(FieldID, opts...).ToFunc() 90 } 91 92 // ByDescription orders the results by the description field. 93 func ByDescription(opts ...sql.OrderTermOption) OrderOption { 94 return sql.OrderByField(FieldDescription, opts...).ToFunc() 95 } 96 97 // ByType orders the results by the type field. 98 func ByType(opts ...sql.OrderTermOption) OrderOption { 99 return sql.OrderByField(FieldType, opts...).ToFunc() 100 } 101 102 // ByApplied orders the results by the applied field. 103 func ByApplied(opts ...sql.OrderTermOption) OrderOption { 104 return sql.OrderByField(FieldApplied, opts...).ToFunc() 105 } 106 107 // ByTotal orders the results by the total field. 108 func ByTotal(opts ...sql.OrderTermOption) OrderOption { 109 return sql.OrderByField(FieldTotal, opts...).ToFunc() 110 } 111 112 // ByExecutedAt orders the results by the executed_at field. 113 func ByExecutedAt(opts ...sql.OrderTermOption) OrderOption { 114 return sql.OrderByField(FieldExecutedAt, opts...).ToFunc() 115 } 116 117 // ByExecutionTime orders the results by the execution_time field. 118 func ByExecutionTime(opts ...sql.OrderTermOption) OrderOption { 119 return sql.OrderByField(FieldExecutionTime, opts...).ToFunc() 120 } 121 122 // ByError orders the results by the error field. 123 func ByError(opts ...sql.OrderTermOption) OrderOption { 124 return sql.OrderByField(FieldError, opts...).ToFunc() 125 } 126 127 // ByErrorStmt orders the results by the error_stmt field. 128 func ByErrorStmt(opts ...sql.OrderTermOption) OrderOption { 129 return sql.OrderByField(FieldErrorStmt, opts...).ToFunc() 130 } 131 132 // ByHash orders the results by the hash field. 133 func ByHash(opts ...sql.OrderTermOption) OrderOption { 134 return sql.OrderByField(FieldHash, opts...).ToFunc() 135 } 136 137 // ByOperatorVersion orders the results by the operator_version field. 138 func ByOperatorVersion(opts ...sql.OrderTermOption) OrderOption { 139 return sql.OrderByField(FieldOperatorVersion, opts...).ToFunc() 140 }