// Code generated by ent, DO NOT EDIT.

package storagepolicy

import (
	"time"

	"entgo.io/ent"
	"entgo.io/ent/dialect/sql"
)

const (
	// Label holds the string label denoting the storagepolicy type in the database.
	Label = "storage_policy"
	// FieldID holds the string denoting the id field in the database.
	FieldID = "id"
	// FieldDeletedAt holds the string denoting the deleted_at field in the database.
	FieldDeletedAt = "deleted_at"
	// 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"
	// FieldType holds the string denoting the type field in the database.
	FieldType = "type"
	// FieldFlag holds the string denoting the flag field in the database.
	FieldFlag = "flag"
	// FieldServer holds the string denoting the server field in the database.
	FieldServer = "server"
	// FieldBucketName holds the string denoting the bucket_name field in the database.
	FieldBucketName = "bucket_name"
	// FieldIsPrivate holds the string denoting the is_private field in the database.
	FieldIsPrivate = "is_private"
	// FieldAccessKey holds the string denoting the access_key field in the database.
	FieldAccessKey = "access_key"
	// FieldSecretKey holds the string denoting the secret_key field in the database.
	FieldSecretKey = "secret_key"
	// FieldMaxSize holds the string denoting the max_size field in the database.
	FieldMaxSize = "max_size"
	// FieldBasePath holds the string denoting the base_path field in the database.
	FieldBasePath = "base_path"
	// FieldVirtualPath holds the string denoting the virtual_path field in the database.
	FieldVirtualPath = "virtual_path"
	// FieldSettings holds the string denoting the settings field in the database.
	FieldSettings = "settings"
	// FieldNodeID holds the string denoting the node_id field in the database.
	FieldNodeID = "node_id"
	// Table holds the table name of the storagepolicy in the database.
	Table = "storage_policies"
)

// Columns holds all SQL columns for storagepolicy fields.
var Columns = []string{
	FieldID,
	FieldDeletedAt,
	FieldCreatedAt,
	FieldUpdatedAt,
	FieldName,
	FieldType,
	FieldFlag,
	FieldServer,
	FieldBucketName,
	FieldIsPrivate,
	FieldAccessKey,
	FieldSecretKey,
	FieldMaxSize,
	FieldBasePath,
	FieldVirtualPath,
	FieldSettings,
	FieldNodeID,
}

// 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/anzhiyu-c/anheyu-app/ent/runtime"
var (
	Hooks [1]ent.Hook
	// 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
	// TypeValidator is a validator for the "type" field. It is called by the builders before save.
	TypeValidator func(string) error
	// FlagValidator is a validator for the "flag" field. It is called by the builders before save.
	FlagValidator func(string) error
	// ServerValidator is a validator for the "server" field. It is called by the builders before save.
	ServerValidator func(string) error
	// BucketNameValidator is a validator for the "bucket_name" field. It is called by the builders before save.
	BucketNameValidator func(string) error
	// BasePathValidator is a validator for the "base_path" field. It is called by the builders before save.
	BasePathValidator func(string) error
	// VirtualPathValidator is a validator for the "virtual_path" field. It is called by the builders before save.
	VirtualPathValidator func(string) error
)

// OrderOption defines the ordering options for the StoragePolicy 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()
}

// ByDeletedAt orders the results by the deleted_at field.
func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldDeletedAt, 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()
}

// 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()
}

// ByFlag orders the results by the flag field.
func ByFlag(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldFlag, opts...).ToFunc()
}

// ByServer orders the results by the server field.
func ByServer(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldServer, opts...).ToFunc()
}

// ByBucketName orders the results by the bucket_name field.
func ByBucketName(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldBucketName, opts...).ToFunc()
}

// ByIsPrivate orders the results by the is_private field.
func ByIsPrivate(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldIsPrivate, opts...).ToFunc()
}

// ByAccessKey orders the results by the access_key field.
func ByAccessKey(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldAccessKey, opts...).ToFunc()
}

// BySecretKey orders the results by the secret_key field.
func BySecretKey(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldSecretKey, opts...).ToFunc()
}

// ByMaxSize orders the results by the max_size field.
func ByMaxSize(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldMaxSize, opts...).ToFunc()
}

// ByBasePath orders the results by the base_path field.
func ByBasePath(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldBasePath, opts...).ToFunc()
}

// ByVirtualPath orders the results by the virtual_path field.
func ByVirtualPath(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldVirtualPath, opts...).ToFunc()
}

// BySettings orders the results by the settings field.
func BySettings(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldSettings, opts...).ToFunc()
}

// ByNodeID orders the results by the node_id field.
func ByNodeID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldNodeID, opts...).ToFunc()
}
