// Code generated by ent, DO NOT EDIT.

package creditusage

import (
	"time"

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

const (
	// Label holds the string label denoting the creditusage type in the database.
	Label = "credit_usage"
	// 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"
	// FieldDeletedAt holds the string denoting the deleted_at field in the database.
	FieldDeletedAt = "deleted_at"
	// FieldUserID holds the string denoting the user_id field in the database.
	FieldUserID = "user_id"
	// FieldNumber holds the string denoting the number field in the database.
	FieldNumber = "number"
	// FieldStatus holds the string denoting the status field in the database.
	FieldStatus = "status"
	// FieldNtype holds the string denoting the ntype field in the database.
	FieldNtype = "ntype"
	// FieldTable holds the string denoting the table field in the database.
	FieldTable = "table"
	// FieldOrganizationID holds the string denoting the organization_id field in the database.
	FieldOrganizationID = "organization_id"
	// FieldNid holds the string denoting the nid field in the database.
	FieldNid = "nid"
	// FieldReason holds the string denoting the reason field in the database.
	FieldReason = "reason"
	// FieldOperator holds the string denoting the operator field in the database.
	FieldOperator = "operator"
	// Table holds the table name of the creditusage in the database.
	Table = "credit_usage"
)

// Columns holds all SQL columns for creditusage fields.
var Columns = []string{
	FieldID,
	FieldCreatedAt,
	FieldUpdatedAt,
	FieldDeletedAt,
	FieldUserID,
	FieldNumber,
	FieldStatus,
	FieldNtype,
	FieldTable,
	FieldOrganizationID,
	FieldNid,
	FieldReason,
	FieldOperator,
}

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

// Note that the variables below are initialized by the runtime
// package on the initialization of the application. Therefore,
// it should be imported in the main as follows:
//
//	import _ "wechat-api/ent/runtime"
var (
	Hooks        [1]ent.Hook
	Interceptors [1]ent.Interceptor
	// 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
	// UserIDValidator is a validator for the "user_id" field. It is called by the builders before save.
	UserIDValidator func(string) error
	// DefaultStatus holds the default value on creation for the "status" field.
	DefaultStatus int
	// StatusValidator is a validator for the "status" field. It is called by the builders before save.
	StatusValidator func(int) error
	// DefaultNtype holds the default value on creation for the "ntype" field.
	DefaultNtype int
	// DefaultTable holds the default value on creation for the "table" field.
	DefaultTable string
	// DefaultNid holds the default value on creation for the "nid" field.
	DefaultNid uint64
	// DefaultReason holds the default value on creation for the "reason" field.
	DefaultReason string
	// ReasonValidator is a validator for the "reason" field. It is called by the builders before save.
	ReasonValidator func(string) error
	// DefaultOperator holds the default value on creation for the "operator" field.
	DefaultOperator string
	// OperatorValidator is a validator for the "operator" field. It is called by the builders before save.
	OperatorValidator func(string) error
)

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

// ByDeletedAt orders the results by the deleted_at field.
func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
}

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

// ByNumber orders the results by the number field.
func ByNumber(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldNumber, opts...).ToFunc()
}

// ByStatus orders the results by the status field.
func ByStatus(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldStatus, opts...).ToFunc()
}

// ByNtype orders the results by the ntype field.
func ByNtype(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldNtype, opts...).ToFunc()
}

// ByTable orders the results by the table field.
func ByTable(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldTable, opts...).ToFunc()
}

// ByOrganizationID orders the results by the organization_id field.
func ByOrganizationID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldOrganizationID, opts...).ToFunc()
}

// ByNid orders the results by the nid field.
func ByNid(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldNid, opts...).ToFunc()
}

// ByReason orders the results by the reason field.
func ByReason(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldReason, opts...).ToFunc()
}

// ByOperator orders the results by the operator field.
func ByOperator(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldOperator, opts...).ToFunc()
}
