Files
MonkeyCode/backend/db/projectgitbot/projectgitbot.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
4.0 KiB
Go

// Code generated by ent, DO NOT EDIT.
package projectgitbot
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 projectgitbot type in the database.
Label = "project_git_bot"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldProjectID holds the string denoting the project_id field in the database.
FieldProjectID = "project_id"
// FieldGitBotID holds the string denoting the git_bot_id field in the database.
FieldGitBotID = "git_bot_id"
// FieldCreatedAt holds the string denoting the created_at field in the database.
FieldCreatedAt = "created_at"
// EdgeProject holds the string denoting the project edge name in mutations.
EdgeProject = "project"
// EdgeGitBot holds the string denoting the git_bot edge name in mutations.
EdgeGitBot = "git_bot"
// Table holds the table name of the projectgitbot in the database.
Table = "project_git_bots"
// ProjectTable is the table that holds the project relation/edge.
ProjectTable = "project_git_bots"
// ProjectInverseTable is the table name for the Project entity.
// It exists in this package in order to avoid circular dependency with the "project" package.
ProjectInverseTable = "projects"
// ProjectColumn is the table column denoting the project relation/edge.
ProjectColumn = "project_id"
// GitBotTable is the table that holds the git_bot relation/edge.
GitBotTable = "project_git_bots"
// 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 projectgitbot fields.
var Columns = []string{
FieldID,
FieldProjectID,
FieldGitBotID,
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 ProjectGitBot 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()
}
// ByProjectID orders the results by the project_id field.
func ByProjectID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldProjectID, opts...).ToFunc()
}
// ByGitBotID orders the results by the git_bot_id field.
func ByGitBotID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldGitBotID, opts...).ToFunc()
}
// ByCreatedAt orders the results by the created_at field.
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
}
// ByProjectField orders the results by project field.
func ByProjectField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newProjectStep(), 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 newProjectStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(ProjectInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, false, ProjectTable, ProjectColumn),
)
}
func newGitBotStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(GitBotInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, false, GitBotTable, GitBotColumn),
)
}