Files
voidraft/internal/models/ent/theme/theme.go
2025-12-20 16:43:04 +08:00

135 lines
4.0 KiB
Go

// Code generated by ent, DO NOT EDIT.
package theme
import (
"fmt"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
)
const (
// Label holds the string label denoting the theme type in the database.
Label = "theme"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldUUID holds the string denoting the uuid field in the database.
FieldUUID = "uuid"
// 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"
// FieldDeletedAt holds the string denoting the deleted_at field in the database.
FieldDeletedAt = "deleted_at"
// FieldName holds the string denoting the name field in the database.
FieldName = "name"
// FieldType holds the string denoting the type field in the database.
FieldType = "type"
// FieldColors holds the string denoting the colors field in the database.
FieldColors = "colors"
// Table holds the table name of the theme in the database.
Table = "themes"
)
// Columns holds all SQL columns for theme fields.
var Columns = []string{
FieldID,
FieldUUID,
FieldCreatedAt,
FieldUpdatedAt,
FieldDeletedAt,
FieldName,
FieldType,
FieldColors,
}
// 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
}
}
return false
}
// Note that the variables below are initialized by the runtime
// package on the initialization of the application. Therefore,
// it should be imported in the main as follows:
//
// import _ "voidraft/internal/models/ent/runtime"
var (
Hooks [2]ent.Hook
Interceptors [1]ent.Interceptor
// DefaultUUID holds the default value on creation for the "uuid" field.
DefaultUUID func() string
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
DefaultCreatedAt func() string
// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
DefaultUpdatedAt func() string
// NameValidator is a validator for the "name" field. It is called by the builders before save.
NameValidator func(string) error
)
// Type defines the type for the "type" enum field.
type Type string
// Type values.
const (
TypeDark Type = "dark"
TypeLight Type = "light"
)
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 TypeDark, TypeLight:
return nil
default:
return fmt.Errorf("theme: invalid enum value for type field: %q", _type)
}
}
// OrderOption defines the ordering options for the Theme 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()
}
// ByUUID orders the results by the uuid field.
func ByUUID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUUID, 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()
}
// ByDeletedAt orders the results by the deleted_at field.
func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
}
// ByName orders the results by the name field.
func ByName(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldName, opts...).ToFunc()
}
// ByType orders the results by the type field.
func ByType(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldType, opts...).ToFunc()
}