// Code generated by ent, DO NOT EDIT.

package auditlog

import (
	"time"

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

const (
	// Label holds the string label denoting the auditlog type in the database.
	Label = "audit_log"
	// FieldID holds the string denoting the id field in the database.
	FieldID = "id"
	// FieldActorID holds the string denoting the actor_id field in the database.
	FieldActorID = "actor_id"
	// FieldAction holds the string denoting the action field in the database.
	FieldAction = "action"
	// FieldTargetID holds the string denoting the target_id field in the database.
	FieldTargetID = "target_id"
	// FieldMetadata holds the string denoting the metadata field in the database.
	FieldMetadata = "metadata"
	// FieldTimestamp holds the string denoting the timestamp field in the database.
	FieldTimestamp = "timestamp"
	// Table holds the table name of the auditlog in the database.
	Table = "audit_logs"
)

// Columns holds all SQL columns for auditlog fields.
var Columns = []string{
	FieldID,
	FieldActorID,
	FieldAction,
	FieldTargetID,
	FieldMetadata,
	FieldTimestamp,
}

// 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 (
	// ActorIDValidator is a validator for the "actor_id" field. It is called by the builders before save.
	ActorIDValidator func(string) error
	// ActionValidator is a validator for the "action" field. It is called by the builders before save.
	ActionValidator func(string) error
	// DefaultTimestamp holds the default value on creation for the "timestamp" field.
	DefaultTimestamp func() time.Time
)

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

// ByActorID orders the results by the actor_id field.
func ByActorID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldActorID, opts...).ToFunc()
}

// ByAction orders the results by the action field.
func ByAction(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldAction, opts...).ToFunc()
}

// ByTargetID orders the results by the target_id field.
func ByTargetID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldTargetID, opts...).ToFunc()
}

// ByTimestamp orders the results by the timestamp field.
func ByTimestamp(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldTimestamp, opts...).ToFunc()
}
