// Code generated by ent, DO NOT EDIT.

package userplatformquota

import (
	"time"

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

const (
	// Label holds the string label denoting the userplatformquota type in the database.
	Label = "user_platform_quota"
	// 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"
	// FieldUserID holds the string denoting the user_id field in the database.
	FieldUserID = "user_id"
	// FieldPlatform holds the string denoting the platform field in the database.
	FieldPlatform = "platform"
	// FieldDailyLimitUsd holds the string denoting the daily_limit_usd field in the database.
	FieldDailyLimitUsd = "daily_limit_usd"
	// FieldWeeklyLimitUsd holds the string denoting the weekly_limit_usd field in the database.
	FieldWeeklyLimitUsd = "weekly_limit_usd"
	// FieldMonthlyLimitUsd holds the string denoting the monthly_limit_usd field in the database.
	FieldMonthlyLimitUsd = "monthly_limit_usd"
	// FieldDailyUsageUsd holds the string denoting the daily_usage_usd field in the database.
	FieldDailyUsageUsd = "daily_usage_usd"
	// FieldWeeklyUsageUsd holds the string denoting the weekly_usage_usd field in the database.
	FieldWeeklyUsageUsd = "weekly_usage_usd"
	// FieldMonthlyUsageUsd holds the string denoting the monthly_usage_usd field in the database.
	FieldMonthlyUsageUsd = "monthly_usage_usd"
	// FieldDailyWindowStart holds the string denoting the daily_window_start field in the database.
	FieldDailyWindowStart = "daily_window_start"
	// FieldWeeklyWindowStart holds the string denoting the weekly_window_start field in the database.
	FieldWeeklyWindowStart = "weekly_window_start"
	// FieldMonthlyWindowStart holds the string denoting the monthly_window_start field in the database.
	FieldMonthlyWindowStart = "monthly_window_start"
	// EdgeUser holds the string denoting the user edge name in mutations.
	EdgeUser = "user"
	// Table holds the table name of the userplatformquota in the database.
	Table = "user_platform_quotas"
	// UserTable is the table that holds the user relation/edge.
	UserTable = "user_platform_quotas"
	// UserInverseTable is the table name for the User entity.
	// It exists in this package in order to avoid circular dependency with the "user" package.
	UserInverseTable = "users"
	// UserColumn is the table column denoting the user relation/edge.
	UserColumn = "user_id"
)

// Columns holds all SQL columns for userplatformquota fields.
var Columns = []string{
	FieldID,
	FieldCreatedAt,
	FieldUpdatedAt,
	FieldDeletedAt,
	FieldUserID,
	FieldPlatform,
	FieldDailyLimitUsd,
	FieldWeeklyLimitUsd,
	FieldMonthlyLimitUsd,
	FieldDailyUsageUsd,
	FieldWeeklyUsageUsd,
	FieldMonthlyUsageUsd,
	FieldDailyWindowStart,
	FieldWeeklyWindowStart,
	FieldMonthlyWindowStart,
}

// 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/Wei-Shaw/sub2api/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
	// PlatformValidator is a validator for the "platform" field. It is called by the builders before save.
	PlatformValidator func(string) error
	// DefaultDailyUsageUsd holds the default value on creation for the "daily_usage_usd" field.
	DefaultDailyUsageUsd float64
	// DefaultWeeklyUsageUsd holds the default value on creation for the "weekly_usage_usd" field.
	DefaultWeeklyUsageUsd float64
	// DefaultMonthlyUsageUsd holds the default value on creation for the "monthly_usage_usd" field.
	DefaultMonthlyUsageUsd float64
)

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

// ByUserID orders the results by the user_id field.
func ByUserID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldUserID, opts...).ToFunc()
}

// ByPlatform orders the results by the platform field.
func ByPlatform(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldPlatform, opts...).ToFunc()
}

// ByDailyLimitUsd orders the results by the daily_limit_usd field.
func ByDailyLimitUsd(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldDailyLimitUsd, opts...).ToFunc()
}

// ByWeeklyLimitUsd orders the results by the weekly_limit_usd field.
func ByWeeklyLimitUsd(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldWeeklyLimitUsd, opts...).ToFunc()
}

// ByMonthlyLimitUsd orders the results by the monthly_limit_usd field.
func ByMonthlyLimitUsd(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldMonthlyLimitUsd, opts...).ToFunc()
}

// ByDailyUsageUsd orders the results by the daily_usage_usd field.
func ByDailyUsageUsd(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldDailyUsageUsd, opts...).ToFunc()
}

// ByWeeklyUsageUsd orders the results by the weekly_usage_usd field.
func ByWeeklyUsageUsd(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldWeeklyUsageUsd, opts...).ToFunc()
}

// ByMonthlyUsageUsd orders the results by the monthly_usage_usd field.
func ByMonthlyUsageUsd(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldMonthlyUsageUsd, opts...).ToFunc()
}

// ByDailyWindowStart orders the results by the daily_window_start field.
func ByDailyWindowStart(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldDailyWindowStart, opts...).ToFunc()
}

// ByWeeklyWindowStart orders the results by the weekly_window_start field.
func ByWeeklyWindowStart(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldWeeklyWindowStart, opts...).ToFunc()
}

// ByMonthlyWindowStart orders the results by the monthly_window_start field.
func ByMonthlyWindowStart(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldMonthlyWindowStart, opts...).ToFunc()
}

// ByUserField orders the results by user field.
func ByUserField(field string, opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newUserStep(), sql.OrderByField(field, opts...))
	}
}
func newUserStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(UserInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.M2O, true, UserTable, UserColumn),
	)
}
