// Code generated by ent, DO NOT EDIT.

package server

import (
	"time"

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

const (
	// Label holds the string label denoting the server type in the database.
	Label = "server"
	// 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"
	// FieldStatus holds the string denoting the status field in the database.
	FieldStatus = "status"
	// 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"
	// FieldPublicIP holds the string denoting the public_ip field in the database.
	FieldPublicIP = "public_ip"
	// FieldPrivateIP holds the string denoting the private_ip field in the database.
	FieldPrivateIP = "private_ip"
	// FieldAdminPort holds the string denoting the admin_port field in the database.
	FieldAdminPort = "admin_port"
	// EdgeWxs holds the string denoting the wxs edge name in mutations.
	EdgeWxs = "wxs"
	// Table holds the table name of the server in the database.
	Table = "server"
	// WxsTable is the table that holds the wxs relation/edge.
	WxsTable = "wx"
	// WxsInverseTable is the table name for the Wx entity.
	// It exists in this package in order to avoid circular dependency with the "wx" package.
	WxsInverseTable = "wx"
	// WxsColumn is the table column denoting the wxs relation/edge.
	WxsColumn = "server_id"
)

// Columns holds all SQL columns for server fields.
var Columns = []string{
	FieldID,
	FieldCreatedAt,
	FieldUpdatedAt,
	FieldStatus,
	FieldDeletedAt,
	FieldName,
	FieldPublicIP,
	FieldPrivateIP,
	FieldAdminPort,
}

// 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 _ "wechat-api/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
	// DefaultStatus holds the default value on creation for the "status" field.
	DefaultStatus uint8
)

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

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

// ByPublicIP orders the results by the public_ip field.
func ByPublicIP(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldPublicIP, opts...).ToFunc()
}

// ByPrivateIP orders the results by the private_ip field.
func ByPrivateIP(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldPrivateIP, opts...).ToFunc()
}

// ByAdminPort orders the results by the admin_port field.
func ByAdminPort(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldAdminPort, opts...).ToFunc()
}

// ByWxsCount orders the results by wxs count.
func ByWxsCount(opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborsCount(s, newWxsStep(), opts...)
	}
}

// ByWxs orders the results by wxs terms.
func ByWxs(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newWxsStep(), append([]sql.OrderTerm{term}, terms...)...)
	}
}
func newWxsStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(WxsInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.O2M, false, WxsTable, WxsColumn),
	)
}
