// Code generated by ent, DO NOT EDIT.

package userloginhistory

import (
	"time"

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

const (
	// Label holds the string label denoting the userloginhistory type in the database.
	Label = "user_login_history"
	// FieldID holds the string denoting the id field in the database.
	FieldID = "id"
	// FieldUserID holds the string denoting the user_id field in the database.
	FieldUserID = "user_id"
	// FieldIP holds the string denoting the ip field in the database.
	FieldIP = "ip"
	// FieldCountry holds the string denoting the country field in the database.
	FieldCountry = "country"
	// FieldProvince holds the string denoting the province field in the database.
	FieldProvince = "province"
	// FieldCity holds the string denoting the city field in the database.
	FieldCity = "city"
	// FieldIsp holds the string denoting the isp field in the database.
	FieldIsp = "isp"
	// FieldAsn holds the string denoting the asn field in the database.
	FieldAsn = "asn"
	// FieldClientVersion holds the string denoting the client_version field in the database.
	FieldClientVersion = "client_version"
	// FieldOsType holds the string denoting the os_type field in the database.
	FieldOsType = "os_type"
	// FieldOsRelease holds the string denoting the os_release field in the database.
	FieldOsRelease = "os_release"
	// FieldHostname holds the string denoting the hostname field in the database.
	FieldHostname = "hostname"
	// FieldClientID holds the string denoting the client_id field in the database.
	FieldClientID = "client_id"
	// FieldCreatedAt holds the string denoting the created_at field in the database.
	FieldCreatedAt = "created_at"
	// EdgeOwner holds the string denoting the owner edge name in mutations.
	EdgeOwner = "owner"
	// Table holds the table name of the userloginhistory in the database.
	Table = "user_login_histories"
	// OwnerTable is the table that holds the owner relation/edge.
	OwnerTable = "user_login_histories"
	// OwnerInverseTable is the table name for the User entity.
	// It exists in this package in order to avoid circular dependency with the "user" package.
	OwnerInverseTable = "users"
	// OwnerColumn is the table column denoting the owner relation/edge.
	OwnerColumn = "user_id"
)

// Columns holds all SQL columns for userloginhistory fields.
var Columns = []string{
	FieldID,
	FieldUserID,
	FieldIP,
	FieldCountry,
	FieldProvince,
	FieldCity,
	FieldIsp,
	FieldAsn,
	FieldClientVersion,
	FieldOsType,
	FieldOsRelease,
	FieldHostname,
	FieldClientID,
	FieldCreatedAt,
}

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

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

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

// ByIP orders the results by the ip field.
func ByIP(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldIP, opts...).ToFunc()
}

// ByCountry orders the results by the country field.
func ByCountry(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldCountry, opts...).ToFunc()
}

// ByProvince orders the results by the province field.
func ByProvince(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldProvince, opts...).ToFunc()
}

// ByCity orders the results by the city field.
func ByCity(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldCity, opts...).ToFunc()
}

// ByIsp orders the results by the isp field.
func ByIsp(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldIsp, opts...).ToFunc()
}

// ByAsn orders the results by the asn field.
func ByAsn(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldAsn, opts...).ToFunc()
}

// ByClientVersion orders the results by the client_version field.
func ByClientVersion(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldClientVersion, opts...).ToFunc()
}

// ByOsType orders the results by the os_type field.
func ByOsType(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldOsType, opts...).ToFunc()
}

// ByOsRelease orders the results by the os_release field.
func ByOsRelease(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldOsRelease, opts...).ToFunc()
}

// ByHostname orders the results by the hostname field.
func ByHostname(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldHostname, opts...).ToFunc()
}

// ByClientID orders the results by the client_id field.
func ByClientID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldClientID, opts...).ToFunc()
}

// ByCreatedAt orders the results by the created_at field.
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
}

// ByOwnerField orders the results by owner field.
func ByOwnerField(field string, opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newOwnerStep(), sql.OrderByField(field, opts...))
	}
}
func newOwnerStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(OwnerInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.M2O, true, OwnerTable, OwnerColumn),
	)
}
