Init V4 community edition (#2265)
* Init V4 community edition * Init V4 community edition
This commit is contained in:
219
ent/node/node.go
Normal file
219
ent/node/node.go
Normal file
@@ -0,0 +1,219 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package node
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"github.com/cloudreve/Cloudreve/v4/inventory/types"
|
||||
)
|
||||
|
||||
const (
|
||||
// Label holds the string label denoting the node type in the database.
|
||||
Label = "node"
|
||||
// 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"
|
||||
// FieldDeletedAt holds the string denoting the deleted_at field in the database.
|
||||
FieldDeletedAt = "deleted_at"
|
||||
// FieldStatus holds the string denoting the status field in the database.
|
||||
FieldStatus = "status"
|
||||
// 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"
|
||||
// FieldServer holds the string denoting the server field in the database.
|
||||
FieldServer = "server"
|
||||
// FieldSlaveKey holds the string denoting the slave_key field in the database.
|
||||
FieldSlaveKey = "slave_key"
|
||||
// FieldCapabilities holds the string denoting the capabilities field in the database.
|
||||
FieldCapabilities = "capabilities"
|
||||
// FieldSettings holds the string denoting the settings field in the database.
|
||||
FieldSettings = "settings"
|
||||
// FieldWeight holds the string denoting the weight field in the database.
|
||||
FieldWeight = "weight"
|
||||
// EdgeStoragePolicy holds the string denoting the storage_policy edge name in mutations.
|
||||
EdgeStoragePolicy = "storage_policy"
|
||||
// Table holds the table name of the node in the database.
|
||||
Table = "nodes"
|
||||
// StoragePolicyTable is the table that holds the storage_policy relation/edge.
|
||||
StoragePolicyTable = "storage_policies"
|
||||
// StoragePolicyInverseTable is the table name for the StoragePolicy entity.
|
||||
// It exists in this package in order to avoid circular dependency with the "storagepolicy" package.
|
||||
StoragePolicyInverseTable = "storage_policies"
|
||||
// StoragePolicyColumn is the table column denoting the storage_policy relation/edge.
|
||||
StoragePolicyColumn = "node_id"
|
||||
)
|
||||
|
||||
// Columns holds all SQL columns for node fields.
|
||||
var Columns = []string{
|
||||
FieldID,
|
||||
FieldCreatedAt,
|
||||
FieldUpdatedAt,
|
||||
FieldDeletedAt,
|
||||
FieldStatus,
|
||||
FieldName,
|
||||
FieldType,
|
||||
FieldServer,
|
||||
FieldSlaveKey,
|
||||
FieldCapabilities,
|
||||
FieldSettings,
|
||||
FieldWeight,
|
||||
}
|
||||
|
||||
// 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 _ "github.com/cloudreve/Cloudreve/v4/ent/runtime"
|
||||
var (
|
||||
Hooks [1]ent.Hook
|
||||
Interceptors [1]ent.Interceptor
|
||||
// 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
|
||||
// DefaultSettings holds the default value on creation for the "settings" field.
|
||||
DefaultSettings *types.NodeSetting
|
||||
// DefaultWeight holds the default value on creation for the "weight" field.
|
||||
DefaultWeight int
|
||||
)
|
||||
|
||||
// Status defines the type for the "status" enum field.
|
||||
type Status string
|
||||
|
||||
// Status values.
|
||||
const (
|
||||
StatusActive Status = "active"
|
||||
StatusSuspended Status = "suspended"
|
||||
)
|
||||
|
||||
func (s Status) String() string {
|
||||
return string(s)
|
||||
}
|
||||
|
||||
// StatusValidator is a validator for the "status" field enum values. It is called by the builders before save.
|
||||
func StatusValidator(s Status) error {
|
||||
switch s {
|
||||
case StatusActive, StatusSuspended:
|
||||
return nil
|
||||
default:
|
||||
return fmt.Errorf("node: invalid enum value for status field: %q", s)
|
||||
}
|
||||
}
|
||||
|
||||
// Type defines the type for the "type" enum field.
|
||||
type Type string
|
||||
|
||||
// Type values.
|
||||
const (
|
||||
TypeMaster Type = "master"
|
||||
TypeSlave Type = "slave"
|
||||
)
|
||||
|
||||
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 TypeMaster, TypeSlave:
|
||||
return nil
|
||||
default:
|
||||
return fmt.Errorf("node: invalid enum value for type field: %q", _type)
|
||||
}
|
||||
}
|
||||
|
||||
// OrderOption defines the ordering options for the Node 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()
|
||||
}
|
||||
|
||||
// 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()
|
||||
}
|
||||
|
||||
// ByStatus orders the results by the status field.
|
||||
func ByStatus(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldStatus, 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()
|
||||
}
|
||||
|
||||
// ByServer orders the results by the server field.
|
||||
func ByServer(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldServer, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// BySlaveKey orders the results by the slave_key field.
|
||||
func BySlaveKey(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldSlaveKey, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByWeight orders the results by the weight field.
|
||||
func ByWeight(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldWeight, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByStoragePolicyCount orders the results by storage_policy count.
|
||||
func ByStoragePolicyCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborsCount(s, newStoragePolicyStep(), opts...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByStoragePolicy orders the results by storage_policy terms.
|
||||
func ByStoragePolicy(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newStoragePolicyStep(), append([]sql.OrderTerm{term}, terms...)...)
|
||||
}
|
||||
}
|
||||
func newStoragePolicyStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(StoragePolicyInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.O2M, false, StoragePolicyTable, StoragePolicyColumn),
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user