Files
MonkeyCode/backend/db/gitbottask/gitbottask.go
yokowu 34320f9ed5 feat(phase6): 添加 gitbot/gittask 实体 schema 和 migration
- 新增 git_bots, git_bot_users, git_bot_tasks, project_git_bots 表
- 添加 user, host, project 到 gitbot 的关联边
- 使用 soft delete 和 created_at 游标
2026-03-19 18:14:53 +08:00

121 lines
3.9 KiB
Go

// Code generated by ent, DO NOT EDIT.
package gitbottask
import (
"time"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"github.com/google/uuid"
)
const (
// Label holds the string label denoting the gitbottask type in the database.
Label = "git_bot_task"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldGitBotID holds the string denoting the git_bot_id field in the database.
FieldGitBotID = "git_bot_id"
// FieldTaskID holds the string denoting the task_id field in the database.
FieldTaskID = "task_id"
// FieldCreatedAt holds the string denoting the created_at field in the database.
FieldCreatedAt = "created_at"
// EdgeTask holds the string denoting the task edge name in mutations.
EdgeTask = "task"
// EdgeGitBot holds the string denoting the git_bot edge name in mutations.
EdgeGitBot = "git_bot"
// Table holds the table name of the gitbottask in the database.
Table = "git_bot_tasks"
// TaskTable is the table that holds the task relation/edge.
TaskTable = "git_bot_tasks"
// TaskInverseTable is the table name for the Task entity.
// It exists in this package in order to avoid circular dependency with the "task" package.
TaskInverseTable = "tasks"
// TaskColumn is the table column denoting the task relation/edge.
TaskColumn = "task_id"
// GitBotTable is the table that holds the git_bot relation/edge.
GitBotTable = "git_bot_tasks"
// GitBotInverseTable is the table name for the GitBot entity.
// It exists in this package in order to avoid circular dependency with the "gitbot" package.
GitBotInverseTable = "git_bots"
// GitBotColumn is the table column denoting the git_bot relation/edge.
GitBotColumn = "git_bot_id"
)
// Columns holds all SQL columns for gitbottask fields.
var Columns = []string{
FieldID,
FieldGitBotID,
FieldTaskID,
FieldCreatedAt,
}
// 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
// DefaultID holds the default value on creation for the "id" field.
DefaultID func() uuid.UUID
)
// OrderOption defines the ordering options for the GitBotTask 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()
}
// ByGitBotID orders the results by the git_bot_id field.
func ByGitBotID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldGitBotID, opts...).ToFunc()
}
// ByTaskID orders the results by the task_id field.
func ByTaskID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldTaskID, opts...).ToFunc()
}
// ByCreatedAt orders the results by the created_at field.
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
}
// ByTaskField orders the results by task field.
func ByTaskField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newTaskStep(), sql.OrderByField(field, opts...))
}
}
// ByGitBotField orders the results by git_bot field.
func ByGitBotField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newGitBotStep(), sql.OrderByField(field, opts...))
}
}
func newTaskStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(TaskInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, TaskTable, TaskColumn),
)
}
func newGitBotStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(GitBotInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, GitBotTable, GitBotColumn),
)
}