mirror of
https://github.com/hay-kot/homebox.git
synced 2024-12-21 06:16:31 +00:00
cd82fe0d89
* remove empty services * remove old factory * remove old static files * cleanup more duplicate service code * file/folder reorg
113 lines
3.5 KiB
Go
113 lines
3.5 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package attachment
|
|
|
|
import (
|
|
"fmt"
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
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"
|
|
// 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"
|
|
// FieldType holds the string denoting the type field in the database.
|
|
FieldType = "type"
|
|
// EdgeItem holds the string denoting the item edge name in mutations.
|
|
EdgeItem = "item"
|
|
// EdgeDocument holds the string denoting the document edge name in mutations.
|
|
EdgeDocument = "document"
|
|
// Table holds the table name of the attachment in the database.
|
|
Table = "attachments"
|
|
// ItemTable is the table that holds the item relation/edge.
|
|
ItemTable = "attachments"
|
|
// ItemInverseTable is the table name for the Item entity.
|
|
// It exists in this package in order to avoid circular dependency with the "item" package.
|
|
ItemInverseTable = "items"
|
|
// ItemColumn is the table column denoting the item relation/edge.
|
|
ItemColumn = "item_attachments"
|
|
// DocumentTable is the table that holds the document relation/edge.
|
|
DocumentTable = "attachments"
|
|
// DocumentInverseTable is the table name for the Document entity.
|
|
// It exists in this package in order to avoid circular dependency with the "document" package.
|
|
DocumentInverseTable = "documents"
|
|
// DocumentColumn is the table column denoting the document relation/edge.
|
|
DocumentColumn = "document_attachments"
|
|
)
|
|
|
|
// Columns holds all SQL columns for attachment fields.
|
|
var Columns = []string{
|
|
FieldID,
|
|
FieldCreatedAt,
|
|
FieldUpdatedAt,
|
|
FieldType,
|
|
}
|
|
|
|
// 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{
|
|
"document_attachments",
|
|
"item_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 (
|
|
// 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
|
|
// DefaultID holds the default value on creation for the "id" field.
|
|
DefaultID func() uuid.UUID
|
|
)
|
|
|
|
// Type defines the type for the "type" enum field.
|
|
type Type string
|
|
|
|
// TypeAttachment is the default value of the Type enum.
|
|
const DefaultType = TypeAttachment
|
|
|
|
// Type values.
|
|
const (
|
|
TypePhoto Type = "photo"
|
|
TypeManual Type = "manual"
|
|
TypeWarranty Type = "warranty"
|
|
TypeAttachment Type = "attachment"
|
|
TypeReceipt Type = "receipt"
|
|
)
|
|
|
|
func (_type Type) String() string {
|
|
return string(_type)
|
|
}
|
|
|
|
// TypeValidator is a validator for the "type" field enum values. It is called by the builders before save.
|
|
func TypeValidator(_type Type) error {
|
|
switch _type {
|
|
case TypePhoto, TypeManual, TypeWarranty, TypeAttachment, TypeReceipt:
|
|
return nil
|
|
default:
|
|
return fmt.Errorf("attachment: invalid enum value for type field: %q", _type)
|
|
}
|
|
}
|