mirror of
https://github.com/hanzoui/registry-backend.git
synced 2026-10-30 20:30:45 +00:00
* Allow multiple storage files per workflow result. * Add migration.
129 lines
4.4 KiB
Go
129 lines
4.4 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package storagefile
|
|
|
|
import (
|
|
"time"
|
|
|
|
"entgo.io/ent/dialect/sql"
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
const (
|
|
// Label holds the string label denoting the storagefile type in the database.
|
|
Label = "storage_file"
|
|
// FieldID holds the string denoting the id field in the database.
|
|
FieldID = "id"
|
|
// FieldCreateTime holds the string denoting the create_time field in the database.
|
|
FieldCreateTime = "create_time"
|
|
// FieldUpdateTime holds the string denoting the update_time field in the database.
|
|
FieldUpdateTime = "update_time"
|
|
// FieldBucketName holds the string denoting the bucket_name field in the database.
|
|
FieldBucketName = "bucket_name"
|
|
// FieldObjectName holds the string denoting the object_name field in the database.
|
|
FieldObjectName = "object_name"
|
|
// FieldFilePath holds the string denoting the file_path field in the database.
|
|
FieldFilePath = "file_path"
|
|
// FieldFileType holds the string denoting the file_type field in the database.
|
|
FieldFileType = "file_type"
|
|
// FieldFileURL holds the string denoting the file_url field in the database.
|
|
FieldFileURL = "file_url"
|
|
// Table holds the table name of the storagefile in the database.
|
|
Table = "storage_files"
|
|
)
|
|
|
|
// Columns holds all SQL columns for storagefile fields.
|
|
var Columns = []string{
|
|
FieldID,
|
|
FieldCreateTime,
|
|
FieldUpdateTime,
|
|
FieldBucketName,
|
|
FieldObjectName,
|
|
FieldFilePath,
|
|
FieldFileType,
|
|
FieldFileURL,
|
|
}
|
|
|
|
// ForeignKeys holds the SQL foreign-keys that are owned by the "storage_files"
|
|
// table and are not defined as standalone fields in the schema.
|
|
var ForeignKeys = []string{
|
|
"ci_workflow_result_storage_file",
|
|
}
|
|
|
|
// 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 (
|
|
// DefaultCreateTime holds the default value on creation for the "create_time" field.
|
|
DefaultCreateTime func() time.Time
|
|
// DefaultUpdateTime holds the default value on creation for the "update_time" field.
|
|
DefaultUpdateTime func() time.Time
|
|
// UpdateDefaultUpdateTime holds the default value on update for the "update_time" field.
|
|
UpdateDefaultUpdateTime func() time.Time
|
|
// BucketNameValidator is a validator for the "bucket_name" field. It is called by the builders before save.
|
|
BucketNameValidator func(string) error
|
|
// ObjectNameValidator is a validator for the "object_name" field. It is called by the builders before save.
|
|
ObjectNameValidator func(string) error
|
|
// FilePathValidator is a validator for the "file_path" field. It is called by the builders before save.
|
|
FilePathValidator func(string) error
|
|
// FileTypeValidator is a validator for the "file_type" field. It is called by the builders before save.
|
|
FileTypeValidator 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 StorageFile 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()
|
|
}
|
|
|
|
// ByCreateTime orders the results by the create_time field.
|
|
func ByCreateTime(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldCreateTime, opts...).ToFunc()
|
|
}
|
|
|
|
// ByUpdateTime orders the results by the update_time field.
|
|
func ByUpdateTime(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldUpdateTime, opts...).ToFunc()
|
|
}
|
|
|
|
// ByBucketName orders the results by the bucket_name field.
|
|
func ByBucketName(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldBucketName, opts...).ToFunc()
|
|
}
|
|
|
|
// ByObjectName orders the results by the object_name field.
|
|
func ByObjectName(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldObjectName, opts...).ToFunc()
|
|
}
|
|
|
|
// ByFilePath orders the results by the file_path field.
|
|
func ByFilePath(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldFilePath, opts...).ToFunc()
|
|
}
|
|
|
|
// ByFileType orders the results by the file_type field.
|
|
func ByFileType(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldFileType, opts...).ToFunc()
|
|
}
|
|
|
|
// ByFileURL orders the results by the file_url field.
|
|
func ByFileURL(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldFileURL, opts...).ToFunc()
|
|
}
|