Files
upstream-mirror 4b3ad0b611
Some checks failed
Atlas CI Public / lint (push) Failing after 13s
Atlas CI Public / sync (push) Has been skipped
snapshot of https://github.com/ent/ent.git (master, 2026-09-15; blobs > 131072B omitted)
2026-09-15 22:12:36 +05:00

105 lines
2.9 KiB
Go

// Copyright 2019-present Facebook Inc. All rights reserved.
// This source code is licensed under the Apache 2.0 license found
// in the LICENSE file in the root directory of this source tree.
// Code generated by ent, DO NOT EDIT.
package document
import (
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/entc/integration/ent/schema"
"entgo.io/ent/schema/field"
)
const (
// Label holds the string label denoting the document type in the database.
Label = "document"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldName holds the string denoting the name field in the database.
FieldName = "name"
// FieldContent holds the string denoting the content field in the database.
FieldContent = "content"
// FieldThumbnail holds the string denoting the thumbnail field in the database.
FieldThumbnail = "thumbnail"
// FieldAttachment holds the string denoting the attachment field in the database.
FieldAttachment = "attachment"
// FieldMetadata holds the string denoting the metadata field in the database.
FieldMetadata = "metadata"
// FieldPayload holds the string denoting the payload field in the database.
FieldPayload = "payload"
// FieldDescription holds the string denoting the description field in the database.
FieldDescription = "description"
// FieldArchive holds the string denoting the archive field in the database.
FieldArchive = "archive"
// Table holds the table name of the document in the database.
Table = "documents"
)
// Columns holds all SQL columns for document fields.
var Columns = []string{
FieldID,
FieldName,
FieldAttachment,
FieldPayload,
"content_key",
"thumbnail_key",
"attachment_key",
"metadata_key",
"payload_key",
"description_key",
"archive_key",
}
// BlobKeys holds the SQL columns for blob storage keys.
var BlobKeys = []string{
"content_key",
"thumbnail_key",
"attachment_key",
"metadata_key",
"payload_key",
"description_key",
"archive_key",
}
// 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 BlobKeys {
if column == BlobKeys[i] {
return true
}
}
return false
}
var (
// NewContentKey generates the blob storage key for the "content" field.
NewContentKey ent.BlobKeyFunc
// ValueScanner of all Document fields.
ValueScanner struct {
Payload field.TypeValueScanner[*schema.DocPayload]
}
)
// OrderOption defines the ordering options for the Document 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()
}
// ByName orders the results by the name field.
func ByName(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldName, opts...).ToFunc()
}
// comment from another template.