// Code generated by ent, DO NOT EDIT.

package systemnetworkstats

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

const (
	// Label holds the string label denoting the systemnetworkstats type in the database.
	Label = "system_network_stats"
	// FieldID holds the string denoting the id field in the database.
	FieldID = "id"
	// FieldBytesSent holds the string denoting the bytes_sent field in the database.
	FieldBytesSent = "bytes_sent"
	// FieldBytesRecv holds the string denoting the bytes_recv field in the database.
	FieldBytesRecv = "bytes_recv"
	// FieldPacketsSent holds the string denoting the packets_sent field in the database.
	FieldPacketsSent = "packets_sent"
	// FieldPacketsRecv holds the string denoting the packets_recv field in the database.
	FieldPacketsRecv = "packets_recv"
	// FieldPeakBytesSentPerSec holds the string denoting the peak_bytes_sent_per_sec field in the database.
	FieldPeakBytesSentPerSec = "peak_bytes_sent_per_sec"
	// FieldPeakBytesRecvPerSec holds the string denoting the peak_bytes_recv_per_sec field in the database.
	FieldPeakBytesRecvPerSec = "peak_bytes_recv_per_sec"
	// FieldPeakPacketsSentPerSec holds the string denoting the peak_packets_sent_per_sec field in the database.
	FieldPeakPacketsSentPerSec = "peak_packets_sent_per_sec"
	// FieldPeakPacketsRecvPerSec holds the string denoting the peak_packets_recv_per_sec field in the database.
	FieldPeakPacketsRecvPerSec = "peak_packets_recv_per_sec"
	// EdgeNetworkMetrics holds the string denoting the network_metrics edge name in mutations.
	EdgeNetworkMetrics = "network_metrics"
	// Table holds the table name of the systemnetworkstats in the database.
	Table = "system_network_stats"
	// NetworkMetricsTable is the table that holds the network_metrics relation/edge.
	NetworkMetricsTable = "system_network_stats"
	// NetworkMetricsInverseTable is the table name for the NetworkMetrics entity.
	// It exists in this package in order to avoid circular dependency with the "networkmetrics" package.
	NetworkMetricsInverseTable = "network_metrics"
	// NetworkMetricsColumn is the table column denoting the network_metrics relation/edge.
	NetworkMetricsColumn = "network_metrics_system_network_stats"
)

// Columns holds all SQL columns for systemnetworkstats fields.
var Columns = []string{
	FieldID,
	FieldBytesSent,
	FieldBytesRecv,
	FieldPacketsSent,
	FieldPacketsRecv,
	FieldPeakBytesSentPerSec,
	FieldPeakBytesRecvPerSec,
	FieldPeakPacketsSentPerSec,
	FieldPeakPacketsRecvPerSec,
}

// ForeignKeys holds the SQL foreign-keys that are owned by the "system_network_stats"
// table and are not defined as standalone fields in the schema.
var ForeignKeys = []string{
	"network_metrics_system_network_stats",
}

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

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

// ByBytesSent orders the results by the bytes_sent field.
func ByBytesSent(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldBytesSent, opts...).ToFunc()
}

// ByBytesRecv orders the results by the bytes_recv field.
func ByBytesRecv(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldBytesRecv, opts...).ToFunc()
}

// ByPacketsSent orders the results by the packets_sent field.
func ByPacketsSent(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldPacketsSent, opts...).ToFunc()
}

// ByPacketsRecv orders the results by the packets_recv field.
func ByPacketsRecv(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldPacketsRecv, opts...).ToFunc()
}

// ByPeakBytesSentPerSec orders the results by the peak_bytes_sent_per_sec field.
func ByPeakBytesSentPerSec(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldPeakBytesSentPerSec, opts...).ToFunc()
}

// ByPeakBytesRecvPerSec orders the results by the peak_bytes_recv_per_sec field.
func ByPeakBytesRecvPerSec(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldPeakBytesRecvPerSec, opts...).ToFunc()
}

// ByPeakPacketsSentPerSec orders the results by the peak_packets_sent_per_sec field.
func ByPeakPacketsSentPerSec(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldPeakPacketsSentPerSec, opts...).ToFunc()
}

// ByPeakPacketsRecvPerSec orders the results by the peak_packets_recv_per_sec field.
func ByPeakPacketsRecvPerSec(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldPeakPacketsRecvPerSec, opts...).ToFunc()
}

// ByNetworkMetricsField orders the results by network_metrics field.
func ByNetworkMetricsField(field string, opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newNetworkMetricsStep(), sql.OrderByField(field, opts...))
	}
}
func newNetworkMetricsStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(NetworkMetricsInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.O2O, true, NetworkMetricsTable, NetworkMetricsColumn),
	)
}
