Add general queue

This commit is contained in:
Achim Rohn
2025-11-16 19:09:01 +01:00
parent ed7ee7e95c
commit bcc5c7493d
60 changed files with 5657 additions and 8506 deletions
+146
View File
@@ -0,0 +1,146 @@
// Code generated by ent, DO NOT EDIT.
package generalqueue
import (
"fmt"
"entgo.io/ent/dialect/sql"
)
const (
// Label holds the string label denoting the generalqueue type in the database.
Label = "general_queue"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldName holds the string denoting the name field in the database.
FieldName = "name"
// FieldPayload holds the string denoting the payload field in the database.
FieldPayload = "payload"
// FieldStatus holds the string denoting the status field in the database.
FieldStatus = "status"
// FieldNumberOfTries holds the string denoting the number_of_tries field in the database.
FieldNumberOfTries = "number_of_tries"
// FieldMaxRetries holds the string denoting the max_retries field in the database.
FieldMaxRetries = "max_retries"
// FieldErrorMessage holds the string denoting the error_message field in the database.
FieldErrorMessage = "error_message"
// FieldFailurePayload holds the string denoting the failure_payload field in the database.
FieldFailurePayload = "failure_payload"
// FieldResultPayload holds the string denoting the result_payload field in the database.
FieldResultPayload = "result_payload"
// 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"
// FieldProcessedAt holds the string denoting the processed_at field in the database.
FieldProcessedAt = "processed_at"
// Table holds the table name of the generalqueue in the database.
Table = "generalQueue"
)
// Columns holds all SQL columns for generalqueue fields.
var Columns = []string{
FieldID,
FieldName,
FieldPayload,
FieldStatus,
FieldNumberOfTries,
FieldMaxRetries,
FieldErrorMessage,
FieldFailurePayload,
FieldResultPayload,
FieldCreatedAt,
FieldUpdatedAt,
FieldProcessedAt,
}
// 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 (
// DefaultNumberOfTries holds the default value on creation for the "number_of_tries" field.
DefaultNumberOfTries int
// DefaultMaxRetries holds the default value on creation for the "max_retries" field.
DefaultMaxRetries int
)
// Status defines the type for the "status" enum field.
type Status string
// Status values.
const (
StatusPending Status = "pending"
StatusInProgress Status = "in_progress"
StatusCompleted Status = "completed"
StatusFailed Status = "failed"
)
func (s Status) String() string {
return string(s)
}
// StatusValidator is a validator for the "status" field enum values. It is called by the builders before save.
func StatusValidator(s Status) error {
switch s {
case StatusPending, StatusInProgress, StatusCompleted, StatusFailed:
return nil
default:
return fmt.Errorf("generalqueue: invalid enum value for status field: %q", s)
}
}
// OrderOption defines the ordering options for the GeneralQueue 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()
}
// ByName orders the results by the name field.
func ByName(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldName, opts...).ToFunc()
}
// ByStatus orders the results by the status field.
func ByStatus(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldStatus, opts...).ToFunc()
}
// ByNumberOfTries orders the results by the number_of_tries field.
func ByNumberOfTries(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldNumberOfTries, opts...).ToFunc()
}
// ByMaxRetries orders the results by the max_retries field.
func ByMaxRetries(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldMaxRetries, opts...).ToFunc()
}
// ByErrorMessage orders the results by the error_message field.
func ByErrorMessage(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldErrorMessage, 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()
}
// ByProcessedAt orders the results by the processed_at field.
func ByProcessedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldProcessedAt, opts...).ToFunc()
}