// Code generated by ent, DO NOT EDIT.

package msg

import (
	"time"

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

const (
	// Label holds the string label denoting the msg type in the database.
	Label = "msg"
	// 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"
	// FieldStatus holds the string denoting the status field in the database.
	FieldStatus = "status"
	// FieldFromwxid holds the string denoting the fromwxid field in the database.
	FieldFromwxid = "fromwxid"
	// FieldToid holds the string denoting the toid field in the database.
	FieldToid = "toid"
	// FieldMsgtype holds the string denoting the msgtype field in the database.
	FieldMsgtype = "msgtype"
	// FieldMsg holds the string denoting the msg field in the database.
	FieldMsg = "msg"
	// FieldBatchNo holds the string denoting the batch_no field in the database.
	FieldBatchNo = "batch_no"
	// Table holds the table name of the msg in the database.
	Table = "msg"
)

// Columns holds all SQL columns for msg fields.
var Columns = []string{
	FieldID,
	FieldCreatedAt,
	FieldUpdatedAt,
	FieldDeletedAt,
	FieldStatus,
	FieldFromwxid,
	FieldToid,
	FieldMsgtype,
	FieldMsg,
	FieldBatchNo,
}

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

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

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

// ByFromwxid orders the results by the fromwxid field.
func ByFromwxid(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldFromwxid, opts...).ToFunc()
}

// ByToid orders the results by the toid field.
func ByToid(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldToid, opts...).ToFunc()
}

// ByMsgtype orders the results by the msgtype field.
func ByMsgtype(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldMsgtype, opts...).ToFunc()
}

// ByMsg orders the results by the msg field.
func ByMsg(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldMsg, opts...).ToFunc()
}

// ByBatchNo orders the results by the batch_no field.
func ByBatchNo(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldBatchNo, opts...).ToFunc()
}
