mirror of
https://github.com/hay-kot/homebox.git
synced 2024-11-16 21:58:40 +00:00
127 lines
4.2 KiB
Go
127 lines
4.2 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package itemfield
|
|
|
|
import (
|
|
"fmt"
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
const (
|
|
// Label holds the string label denoting the itemfield type in the database.
|
|
Label = "item_field"
|
|
// 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"
|
|
// FieldName holds the string denoting the name field in the database.
|
|
FieldName = "name"
|
|
// FieldDescription holds the string denoting the description field in the database.
|
|
FieldDescription = "description"
|
|
// FieldType holds the string denoting the type field in the database.
|
|
FieldType = "type"
|
|
// FieldTextValue holds the string denoting the text_value field in the database.
|
|
FieldTextValue = "text_value"
|
|
// FieldNumberValue holds the string denoting the number_value field in the database.
|
|
FieldNumberValue = "number_value"
|
|
// FieldBooleanValue holds the string denoting the boolean_value field in the database.
|
|
FieldBooleanValue = "boolean_value"
|
|
// FieldTimeValue holds the string denoting the time_value field in the database.
|
|
FieldTimeValue = "time_value"
|
|
// EdgeItem holds the string denoting the item edge name in mutations.
|
|
EdgeItem = "item"
|
|
// Table holds the table name of the itemfield in the database.
|
|
Table = "item_fields"
|
|
// ItemTable is the table that holds the item relation/edge.
|
|
ItemTable = "item_fields"
|
|
// 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_fields"
|
|
)
|
|
|
|
// Columns holds all SQL columns for itemfield fields.
|
|
var Columns = []string{
|
|
FieldID,
|
|
FieldCreatedAt,
|
|
FieldUpdatedAt,
|
|
FieldName,
|
|
FieldDescription,
|
|
FieldType,
|
|
FieldTextValue,
|
|
FieldNumberValue,
|
|
FieldBooleanValue,
|
|
FieldTimeValue,
|
|
}
|
|
|
|
// ForeignKeys holds the SQL foreign-keys that are owned by the "item_fields"
|
|
// table and are not defined as standalone fields in the schema.
|
|
var ForeignKeys = []string{
|
|
"item_fields",
|
|
}
|
|
|
|
// 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
|
|
// NameValidator is a validator for the "name" field. It is called by the builders before save.
|
|
NameValidator func(string) error
|
|
// DescriptionValidator is a validator for the "description" field. It is called by the builders before save.
|
|
DescriptionValidator func(string) error
|
|
// TextValueValidator is a validator for the "text_value" field. It is called by the builders before save.
|
|
TextValueValidator func(string) error
|
|
// DefaultBooleanValue holds the default value on creation for the "boolean_value" field.
|
|
DefaultBooleanValue bool
|
|
// DefaultTimeValue holds the default value on creation for the "time_value" field.
|
|
DefaultTimeValue 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
|
|
|
|
// Type values.
|
|
const (
|
|
TypeText Type = "text"
|
|
TypeNumber Type = "number"
|
|
TypeBoolean Type = "boolean"
|
|
TypeTime Type = "time"
|
|
)
|
|
|
|
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 TypeText, TypeNumber, TypeBoolean, TypeTime:
|
|
return nil
|
|
default:
|
|
return fmt.Errorf("itemfield: invalid enum value for type field: %q", _type)
|
|
}
|
|
}
|