// Code generated by ent, DO NOT EDIT. package attachment import ( "time" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "github.com/google/uuid" "github.com/lysand-org/versia-go/pkg/versia" ) const ( // Label holds the string label denoting the attachment type in the database. Label = "attachment" // FieldID holds the string denoting the id field in the database. FieldID = "id" // FieldIsRemote holds the string denoting the isremote field in the database. FieldIsRemote = "is_remote" // FieldURI holds the string denoting the uri field in the database. FieldURI = "uri" // FieldExtensions holds the string denoting the extensions field in the database. FieldExtensions = "extensions" // FieldCreatedAt holds the string denoting the created_at field in the database. FieldCreatedAt = "created_at" // FieldUpdatedAt holds the string denoting the updated_at field in the database. FieldUpdatedAt = "updated_at" // FieldDescription holds the string denoting the description field in the database. FieldDescription = "description" // FieldSha256 holds the string denoting the sha256 field in the database. FieldSha256 = "sha256" // FieldSize holds the string denoting the size field in the database. FieldSize = "size" // FieldBlurhash holds the string denoting the blurhash field in the database. FieldBlurhash = "blurhash" // FieldHeight holds the string denoting the height field in the database. FieldHeight = "height" // FieldWidth holds the string denoting the width field in the database. FieldWidth = "width" // FieldFps holds the string denoting the fps field in the database. FieldFps = "fps" // FieldMimeType holds the string denoting the mimetype field in the database. FieldMimeType = "mime_type" // EdgeAuthor holds the string denoting the author edge name in mutations. EdgeAuthor = "author" // Table holds the table name of the attachment in the database. Table = "attachments" // AuthorTable is the table that holds the author relation/edge. AuthorTable = "attachments" // AuthorInverseTable is the table name for the User entity. // It exists in this package in order to avoid circular dependency with the "user" package. AuthorInverseTable = "users" // AuthorColumn is the table column denoting the author relation/edge. AuthorColumn = "attachment_author" ) // Columns holds all SQL columns for attachment fields. var Columns = []string{ FieldID, FieldIsRemote, FieldURI, FieldExtensions, FieldCreatedAt, FieldUpdatedAt, FieldDescription, FieldSha256, FieldSize, FieldBlurhash, FieldHeight, FieldWidth, FieldFps, FieldMimeType, } // ForeignKeys holds the SQL foreign-keys that are owned by the "attachments" // table and are not defined as standalone fields in the schema. var ForeignKeys = []string{ "attachment_author", "note_attachments", } // ValidColumn reports if the column name is valid (part of the table columns). func ValidColumn(column string) bool { for i := range Columns { if column == Columns[i] { return true } } for i := range ForeignKeys { if column == ForeignKeys[i] { return true } } return false } var ( // URIValidator is a validator for the "uri" field. It is called by the builders before save. URIValidator func(string) error // DefaultExtensions holds the default value on creation for the "extensions" field. DefaultExtensions versia.Extensions // DefaultCreatedAt holds the default value on creation for the "created_at" field. DefaultCreatedAt func() time.Time // DefaultUpdatedAt holds the default value on creation for the "updated_at" field. DefaultUpdatedAt func() time.Time // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field. UpdateDefaultUpdatedAt func() time.Time // DescriptionValidator is a validator for the "description" field. It is called by the builders before save. DescriptionValidator func(string) error // DefaultID holds the default value on creation for the "id" field. DefaultID func() uuid.UUID ) // OrderOption defines the ordering options for the Attachment queries. type OrderOption func(*sql.Selector) // ByID orders the results by the id field. func ByID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldID, opts...).ToFunc() } // ByIsRemote orders the results by the isRemote field. func ByIsRemote(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldIsRemote, opts...).ToFunc() } // ByURI orders the results by the uri field. func ByURI(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldURI, opts...).ToFunc() } // ByCreatedAt orders the results by the created_at field. func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldCreatedAt, opts...).ToFunc() } // ByUpdatedAt orders the results by the updated_at field. func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc() } // ByDescription orders the results by the description field. func ByDescription(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldDescription, opts...).ToFunc() } // BySize orders the results by the size field. func BySize(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldSize, opts...).ToFunc() } // ByBlurhash orders the results by the blurhash field. func ByBlurhash(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldBlurhash, opts...).ToFunc() } // ByHeight orders the results by the height field. func ByHeight(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldHeight, opts...).ToFunc() } // ByWidth orders the results by the width field. func ByWidth(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldWidth, opts...).ToFunc() } // ByFps orders the results by the fps field. func ByFps(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldFps, opts...).ToFunc() } // ByMimeType orders the results by the mimeType field. func ByMimeType(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldMimeType, opts...).ToFunc() } // ByAuthorField orders the results by author field. func ByAuthorField(field string, opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newAuthorStep(), sql.OrderByField(field, opts...)) } } func newAuthorStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), sqlgraph.To(AuthorInverseTable, FieldID), sqlgraph.Edge(sqlgraph.M2O, false, AuthorTable, AuthorColumn), ) }