124 lines
4.0 KiB
Go
124 lines
4.0 KiB
Go
|
// Code generated by ent, DO NOT EDIT.
|
||
|
|
||
|
package usersession
|
||
|
|
||
|
import (
|
||
|
"entgo.io/ent/dialect/sql"
|
||
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||
|
)
|
||
|
|
||
|
const (
|
||
|
// Label holds the string label denoting the usersession type in the database.
|
||
|
Label = "user_session"
|
||
|
// FieldID holds the string denoting the id field in the database.
|
||
|
FieldID = "id"
|
||
|
// FieldIssuedAt holds the string denoting the issued_at field in the database.
|
||
|
FieldIssuedAt = "issued_at"
|
||
|
// FieldExpiresAt holds the string denoting the expires_at field in the database.
|
||
|
FieldExpiresAt = "expires_at"
|
||
|
// FieldInvalidated holds the string denoting the invalidated field in the database.
|
||
|
FieldInvalidated = "invalidated"
|
||
|
// FieldUserAgent holds the string denoting the user_agent field in the database.
|
||
|
FieldUserAgent = "user_agent"
|
||
|
// FieldIP holds the string denoting the ip field in the database.
|
||
|
FieldIP = "ip"
|
||
|
// EdgeUser holds the string denoting the user edge name in mutations.
|
||
|
EdgeUser = "user"
|
||
|
// Table holds the table name of the usersession in the database.
|
||
|
Table = "user_sessions"
|
||
|
// UserTable is the table that holds the user relation/edge.
|
||
|
UserTable = "user_sessions"
|
||
|
// 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 usersession fields.
|
||
|
var Columns = []string{
|
||
|
FieldID,
|
||
|
FieldIssuedAt,
|
||
|
FieldExpiresAt,
|
||
|
FieldInvalidated,
|
||
|
FieldUserAgent,
|
||
|
FieldIP,
|
||
|
}
|
||
|
|
||
|
// ForeignKeys holds the SQL foreign-keys that are owned by the "user_sessions"
|
||
|
// table and are not defined as standalone fields in the schema.
|
||
|
var ForeignKeys = []string{
|
||
|
"user_id",
|
||
|
}
|
||
|
|
||
|
// 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
|
||
|
}
|
||
|
|
||
|
var (
|
||
|
// DefaultInvalidated holds the default value on creation for the "invalidated" field.
|
||
|
DefaultInvalidated bool
|
||
|
// UserAgentValidator is a validator for the "user_agent" field. It is called by the builders before save.
|
||
|
UserAgentValidator func(string) error
|
||
|
// IPValidator is a validator for the "ip" field. It is called by the builders before save.
|
||
|
IPValidator func(string) error
|
||
|
)
|
||
|
|
||
|
// OrderOption defines the ordering options for the UserSession 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()
|
||
|
}
|
||
|
|
||
|
// ByIssuedAt orders the results by the issued_at field.
|
||
|
func ByIssuedAt(opts ...sql.OrderTermOption) OrderOption {
|
||
|
return sql.OrderByField(FieldIssuedAt, opts...).ToFunc()
|
||
|
}
|
||
|
|
||
|
// ByExpiresAt orders the results by the expires_at field.
|
||
|
func ByExpiresAt(opts ...sql.OrderTermOption) OrderOption {
|
||
|
return sql.OrderByField(FieldExpiresAt, opts...).ToFunc()
|
||
|
}
|
||
|
|
||
|
// ByInvalidated orders the results by the invalidated field.
|
||
|
func ByInvalidated(opts ...sql.OrderTermOption) OrderOption {
|
||
|
return sql.OrderByField(FieldInvalidated, opts...).ToFunc()
|
||
|
}
|
||
|
|
||
|
// ByUserAgent orders the results by the user_agent field.
|
||
|
func ByUserAgent(opts ...sql.OrderTermOption) OrderOption {
|
||
|
return sql.OrderByField(FieldUserAgent, opts...).ToFunc()
|
||
|
}
|
||
|
|
||
|
// ByIP orders the results by the ip field.
|
||
|
func ByIP(opts ...sql.OrderTermOption) OrderOption {
|
||
|
return sql.OrderByField(FieldIP, 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),
|
||
|
)
|
||
|
}
|