|
|
|
|
// Code generated by ent, DO NOT EDIT.
|
|
|
|
|
|
|
|
|
|
package authsession
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"entgo.io/ent/dialect/sql"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
// Label holds the string label denoting the authsession type in the database.
|
|
|
|
|
Label = "auth_session"
|
|
|
|
|
// 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"
|
|
|
|
|
// FieldConnectorID holds the string denoting the connector_id field in the database.
|
|
|
|
|
FieldConnectorID = "connector_id"
|
|
|
|
|
// FieldNonce holds the string denoting the nonce field in the database.
|
|
|
|
|
FieldNonce = "nonce"
|
|
|
|
|
// FieldClientStates holds the string denoting the client_states field in the database.
|
|
|
|
|
FieldClientStates = "client_states"
|
|
|
|
|
// FieldCreatedAt holds the string denoting the created_at field in the database.
|
|
|
|
|
FieldCreatedAt = "created_at"
|
|
|
|
|
// FieldLastActivity holds the string denoting the last_activity field in the database.
|
|
|
|
|
FieldLastActivity = "last_activity"
|
|
|
|
|
// FieldIPAddress holds the string denoting the ip_address field in the database.
|
|
|
|
|
FieldIPAddress = "ip_address"
|
|
|
|
|
// FieldUserAgent holds the string denoting the user_agent field in the database.
|
|
|
|
|
FieldUserAgent = "user_agent"
|
|
|
|
|
// FieldAbsoluteExpiry holds the string denoting the absolute_expiry field in the database.
|
|
|
|
|
FieldAbsoluteExpiry = "absolute_expiry"
|
|
|
|
|
// FieldIdleExpiry holds the string denoting the idle_expiry field in the database.
|
|
|
|
|
FieldIdleExpiry = "idle_expiry"
|
|
|
|
|
// Table holds the table name of the authsession in the database.
|
|
|
|
|
Table = "auth_sessions"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// Columns holds all SQL columns for authsession fields.
|
|
|
|
|
var Columns = []string{
|
|
|
|
|
FieldID,
|
|
|
|
|
FieldUserID,
|
|
|
|
|
FieldConnectorID,
|
|
|
|
|
FieldNonce,
|
|
|
|
|
FieldClientStates,
|
|
|
|
|
FieldCreatedAt,
|
|
|
|
|
FieldLastActivity,
|
|
|
|
|
FieldIPAddress,
|
|
|
|
|
FieldUserAgent,
|
|
|
|
|
FieldAbsoluteExpiry,
|
|
|
|
|
FieldIdleExpiry,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 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 (
|
|
|
|
|
// UserIDValidator is a validator for the "user_id" field. It is called by the builders before save.
|
|
|
|
|
UserIDValidator func(string) error
|
|
|
|
|
// ConnectorIDValidator is a validator for the "connector_id" field. It is called by the builders before save.
|
|
|
|
|
ConnectorIDValidator func(string) error
|
|
|
|
|
// NonceValidator is a validator for the "nonce" field. It is called by the builders before save.
|
|
|
|
|
NonceValidator func(string) error
|
|
|
|
|
// DefaultIPAddress holds the default value on creation for the "ip_address" field.
|
|
|
|
|
DefaultIPAddress string
|
|
|
|
|
// DefaultUserAgent holds the default value on creation for the "user_agent" field.
|
|
|
|
|
DefaultUserAgent string
|
|
|
|
|
// IDValidator is a validator for the "id" field. It is called by the builders before save.
|
|
|
|
|
IDValidator func(string) error
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// OrderOption defines the ordering options for the AuthSession 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()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ByConnectorID orders the results by the connector_id field.
|
|
|
|
|
func ByConnectorID(opts ...sql.OrderTermOption) OrderOption {
|
|
|
|
|
return sql.OrderByField(FieldConnectorID, opts...).ToFunc()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ByNonce orders the results by the nonce field.
|
|
|
|
|
func ByNonce(opts ...sql.OrderTermOption) OrderOption {
|
|
|
|
|
return sql.OrderByField(FieldNonce, opts...).ToFunc()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ByCreatedAt orders the results by the created_at field.
|
|
|
|
|
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
|
|
|
|
|
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ByLastActivity orders the results by the last_activity field.
|
|
|
|
|
func ByLastActivity(opts ...sql.OrderTermOption) OrderOption {
|
|
|
|
|
return sql.OrderByField(FieldLastActivity, opts...).ToFunc()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ByIPAddress orders the results by the ip_address field.
|
|
|
|
|
func ByIPAddress(opts ...sql.OrderTermOption) OrderOption {
|
|
|
|
|
return sql.OrderByField(FieldIPAddress, opts...).ToFunc()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ByUserAgent orders the results by the user_agent field.
|
|
|
|
|
func ByUserAgent(opts ...sql.OrderTermOption) OrderOption {
|
|
|
|
|
return sql.OrderByField(FieldUserAgent, opts...).ToFunc()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ByAbsoluteExpiry orders the results by the absolute_expiry field.
|
|
|
|
|
func ByAbsoluteExpiry(opts ...sql.OrderTermOption) OrderOption {
|
|
|
|
|
return sql.OrderByField(FieldAbsoluteExpiry, opts...).ToFunc()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ByIdleExpiry orders the results by the idle_expiry field.
|
|
|
|
|
func ByIdleExpiry(opts ...sql.OrderTermOption) OrderOption {
|
|
|
|
|
return sql.OrderByField(FieldIdleExpiry, opts...).ToFunc()
|
|
|
|
|
}
|