// Code generated by ent, DO NOT EDIT.

package authidentitychannel

import (
	"time"

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

const (
	// Label holds the string label denoting the authidentitychannel type in the database.
	Label = "auth_identity_channel"
	// 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"
	// FieldIdentityID holds the string denoting the identity_id field in the database.
	FieldIdentityID = "identity_id"
	// FieldProviderType holds the string denoting the provider_type field in the database.
	FieldProviderType = "provider_type"
	// FieldProviderKey holds the string denoting the provider_key field in the database.
	FieldProviderKey = "provider_key"
	// FieldChannel holds the string denoting the channel field in the database.
	FieldChannel = "channel"
	// FieldChannelAppID holds the string denoting the channel_app_id field in the database.
	FieldChannelAppID = "channel_app_id"
	// FieldChannelSubject holds the string denoting the channel_subject field in the database.
	FieldChannelSubject = "channel_subject"
	// FieldMetadata holds the string denoting the metadata field in the database.
	FieldMetadata = "metadata"
	// EdgeIdentity holds the string denoting the identity edge name in mutations.
	EdgeIdentity = "identity"
	// Table holds the table name of the authidentitychannel in the database.
	Table = "auth_identity_channels"
	// IdentityTable is the table that holds the identity relation/edge.
	IdentityTable = "auth_identity_channels"
	// IdentityInverseTable is the table name for the AuthIdentity entity.
	// It exists in this package in order to avoid circular dependency with the "authidentity" package.
	IdentityInverseTable = "auth_identities"
	// IdentityColumn is the table column denoting the identity relation/edge.
	IdentityColumn = "identity_id"
)

// Columns holds all SQL columns for authidentitychannel fields.
var Columns = []string{
	FieldID,
	FieldCreatedAt,
	FieldUpdatedAt,
	FieldIdentityID,
	FieldProviderType,
	FieldProviderKey,
	FieldChannel,
	FieldChannelAppID,
	FieldChannelSubject,
	FieldMetadata,
}

// 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
	// ProviderTypeValidator is a validator for the "provider_type" field. It is called by the builders before save.
	ProviderTypeValidator func(string) error
	// ProviderKeyValidator is a validator for the "provider_key" field. It is called by the builders before save.
	ProviderKeyValidator func(string) error
	// ChannelValidator is a validator for the "channel" field. It is called by the builders before save.
	ChannelValidator func(string) error
	// ChannelAppIDValidator is a validator for the "channel_app_id" field. It is called by the builders before save.
	ChannelAppIDValidator func(string) error
	// ChannelSubjectValidator is a validator for the "channel_subject" field. It is called by the builders before save.
	ChannelSubjectValidator func(string) error
	// DefaultMetadata holds the default value on creation for the "metadata" field.
	DefaultMetadata func() map[string]interface{}
)

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

// ByIdentityID orders the results by the identity_id field.
func ByIdentityID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldIdentityID, opts...).ToFunc()
}

// ByProviderType orders the results by the provider_type field.
func ByProviderType(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldProviderType, opts...).ToFunc()
}

// ByProviderKey orders the results by the provider_key field.
func ByProviderKey(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldProviderKey, opts...).ToFunc()
}

// ByChannel orders the results by the channel field.
func ByChannel(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldChannel, opts...).ToFunc()
}

// ByChannelAppID orders the results by the channel_app_id field.
func ByChannelAppID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldChannelAppID, opts...).ToFunc()
}

// ByChannelSubject orders the results by the channel_subject field.
func ByChannelSubject(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldChannelSubject, opts...).ToFunc()
}

// ByIdentityField orders the results by identity field.
func ByIdentityField(field string, opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newIdentityStep(), sql.OrderByField(field, opts...))
	}
}
func newIdentityStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(IdentityInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.M2O, true, IdentityTable, IdentityColumn),
	)
}
