// Code generated by ent, DO NOT EDIT.

package urlstat

import (
	"time"

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

const (
	// Label holds the string label denoting the urlstat type in the database.
	Label = "url_stat"
	// 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"
	// FieldURLPath holds the string denoting the url_path field in the database.
	FieldURLPath = "url_path"
	// FieldPageTitle holds the string denoting the page_title field in the database.
	FieldPageTitle = "page_title"
	// FieldTotalViews holds the string denoting the total_views field in the database.
	FieldTotalViews = "total_views"
	// FieldUniqueViews holds the string denoting the unique_views field in the database.
	FieldUniqueViews = "unique_views"
	// FieldBounceCount holds the string denoting the bounce_count field in the database.
	FieldBounceCount = "bounce_count"
	// FieldAvgDuration holds the string denoting the avg_duration field in the database.
	FieldAvgDuration = "avg_duration"
	// FieldLastVisitedAt holds the string denoting the last_visited_at field in the database.
	FieldLastVisitedAt = "last_visited_at"
	// Table holds the table name of the urlstat in the database.
	Table = "url_stats"
)

// Columns holds all SQL columns for urlstat fields.
var Columns = []string{
	FieldID,
	FieldCreatedAt,
	FieldUpdatedAt,
	FieldURLPath,
	FieldPageTitle,
	FieldTotalViews,
	FieldUniqueViews,
	FieldBounceCount,
	FieldAvgDuration,
	FieldLastVisitedAt,
}

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

var (
	// 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
	// URLPathValidator is a validator for the "url_path" field. It is called by the builders before save.
	URLPathValidator func(string) error
	// PageTitleValidator is a validator for the "page_title" field. It is called by the builders before save.
	PageTitleValidator func(string) error
	// DefaultTotalViews holds the default value on creation for the "total_views" field.
	DefaultTotalViews int64
	// DefaultUniqueViews holds the default value on creation for the "unique_views" field.
	DefaultUniqueViews int64
	// DefaultBounceCount holds the default value on creation for the "bounce_count" field.
	DefaultBounceCount int64
	// DefaultAvgDuration holds the default value on creation for the "avg_duration" field.
	DefaultAvgDuration float64
)

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

// ByURLPath orders the results by the url_path field.
func ByURLPath(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldURLPath, opts...).ToFunc()
}

// ByPageTitle orders the results by the page_title field.
func ByPageTitle(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldPageTitle, opts...).ToFunc()
}

// ByTotalViews orders the results by the total_views field.
func ByTotalViews(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldTotalViews, opts...).ToFunc()
}

// ByUniqueViews orders the results by the unique_views field.
func ByUniqueViews(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldUniqueViews, opts...).ToFunc()
}

// ByBounceCount orders the results by the bounce_count field.
func ByBounceCount(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldBounceCount, opts...).ToFunc()
}

// ByAvgDuration orders the results by the avg_duration field.
func ByAvgDuration(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldAvgDuration, opts...).ToFunc()
}

// ByLastVisitedAt orders the results by the last_visited_at field.
func ByLastVisitedAt(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldLastVisitedAt, opts...).ToFunc()
}
