Files
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

376 lines
14 KiB
Go

// Code generated by ent, DO NOT EDIT.
package project
import (
"time"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
)
const (
// Label holds the string label denoting the project type in the database.
Label = "project"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// 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"
// FieldName holds the string denoting the name field in the database.
FieldName = "name"
// FieldDescription holds the string denoting the description field in the database.
FieldDescription = "description"
// FieldPlatform holds the string denoting the platform field in the database.
FieldPlatform = "platform"
// FieldRepoURL holds the string denoting the repo_url field in the database.
FieldRepoURL = "repo_url"
// FieldBranch holds the string denoting the branch field in the database.
FieldBranch = "branch"
// FieldGitIdentityID holds the string denoting the git_identity_id field in the database.
FieldGitIdentityID = "git_identity_id"
// FieldImageID holds the string denoting the image_id field in the database.
FieldImageID = "image_id"
// FieldEnvVariables holds the string denoting the env_variables field in the database.
FieldEnvVariables = "env_variables"
// 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"
// EdgeUser holds the string denoting the user edge name in mutations.
EdgeUser = "user"
// EdgeGitIdentity holds the string denoting the git_identity edge name in mutations.
EdgeGitIdentity = "git_identity"
// EdgeImage holds the string denoting the image edge name in mutations.
EdgeImage = "image"
// EdgeIssues holds the string denoting the issues edge name in mutations.
EdgeIssues = "issues"
// EdgeCollaborators holds the string denoting the collaborators edge name in mutations.
EdgeCollaborators = "collaborators"
// EdgeProjectTasks holds the string denoting the project_tasks edge name in mutations.
EdgeProjectTasks = "project_tasks"
// EdgeGitBots holds the string denoting the git_bots edge name in mutations.
EdgeGitBots = "git_bots"
// EdgeProjectGitBots holds the string denoting the project_git_bots edge name in mutations.
EdgeProjectGitBots = "project_git_bots"
// Table holds the table name of the project in the database.
Table = "projects"
// UserTable is the table that holds the user relation/edge.
UserTable = "projects"
// UserInverseTable is the table name for the User entity.
// It exists in this package in order to avoid circular dependency with the "user" package.
UserInverseTable = "users"
// UserColumn is the table column denoting the user relation/edge.
UserColumn = "user_id"
// GitIdentityTable is the table that holds the git_identity relation/edge.
GitIdentityTable = "projects"
// GitIdentityInverseTable is the table name for the GitIdentity entity.
// It exists in this package in order to avoid circular dependency with the "gitidentity" package.
GitIdentityInverseTable = "git_identities"
// GitIdentityColumn is the table column denoting the git_identity relation/edge.
GitIdentityColumn = "git_identity_id"
// ImageTable is the table that holds the image relation/edge.
ImageTable = "projects"
// ImageInverseTable is the table name for the Image entity.
// It exists in this package in order to avoid circular dependency with the "image" package.
ImageInverseTable = "images"
// ImageColumn is the table column denoting the image relation/edge.
ImageColumn = "image_id"
// IssuesTable is the table that holds the issues relation/edge.
IssuesTable = "project_issues"
// IssuesInverseTable is the table name for the ProjectIssue entity.
// It exists in this package in order to avoid circular dependency with the "projectissue" package.
IssuesInverseTable = "project_issues"
// IssuesColumn is the table column denoting the issues relation/edge.
IssuesColumn = "project_id"
// CollaboratorsTable is the table that holds the collaborators relation/edge.
CollaboratorsTable = "project_collaborators"
// CollaboratorsInverseTable is the table name for the ProjectCollaborator entity.
// It exists in this package in order to avoid circular dependency with the "projectcollaborator" package.
CollaboratorsInverseTable = "project_collaborators"
// CollaboratorsColumn is the table column denoting the collaborators relation/edge.
CollaboratorsColumn = "project_id"
// ProjectTasksTable is the table that holds the project_tasks relation/edge.
ProjectTasksTable = "project_tasks"
// ProjectTasksInverseTable is the table name for the ProjectTask entity.
// It exists in this package in order to avoid circular dependency with the "projecttask" package.
ProjectTasksInverseTable = "project_tasks"
// ProjectTasksColumn is the table column denoting the project_tasks relation/edge.
ProjectTasksColumn = "project_id"
// GitBotsTable is the table that holds the git_bots relation/edge. The primary key declared below.
GitBotsTable = "project_git_bots"
// GitBotsInverseTable is the table name for the GitBot entity.
// It exists in this package in order to avoid circular dependency with the "gitbot" package.
GitBotsInverseTable = "git_bots"
// ProjectGitBotsTable is the table that holds the project_git_bots relation/edge.
ProjectGitBotsTable = "project_git_bots"
// ProjectGitBotsInverseTable is the table name for the ProjectGitBot entity.
// It exists in this package in order to avoid circular dependency with the "projectgitbot" package.
ProjectGitBotsInverseTable = "project_git_bots"
// ProjectGitBotsColumn is the table column denoting the project_git_bots relation/edge.
ProjectGitBotsColumn = "project_id"
)
// Columns holds all SQL columns for project fields.
var Columns = []string{
FieldID,
FieldDeletedAt,
FieldUserID,
FieldName,
FieldDescription,
FieldPlatform,
FieldRepoURL,
FieldBranch,
FieldGitIdentityID,
FieldImageID,
FieldEnvVariables,
FieldCreatedAt,
FieldUpdatedAt,
}
var (
// GitBotsPrimaryKey and GitBotsColumn2 are the table columns denoting the
// primary key for the git_bots relation (M2M).
GitBotsPrimaryKey = []string{"project_id", "git_bot_id"}
)
// 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 _ "github.com/chaitin/MonkeyCode/backend/db/runtime"
var (
Hooks [1]ent.Hook
Interceptors [1]ent.Interceptor
// NameValidator is a validator for the "name" field. It is called by the builders before save.
NameValidator func(string) error
// 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 Project 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()
}
// 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()
}
// ByName orders the results by the name field.
func ByName(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldName, opts...).ToFunc()
}
// ByDescription orders the results by the description field.
func ByDescription(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDescription, opts...).ToFunc()
}
// ByPlatform orders the results by the platform field.
func ByPlatform(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldPlatform, opts...).ToFunc()
}
// ByRepoURL orders the results by the repo_url field.
func ByRepoURL(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldRepoURL, opts...).ToFunc()
}
// ByBranch orders the results by the branch field.
func ByBranch(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldBranch, opts...).ToFunc()
}
// ByGitIdentityID orders the results by the git_identity_id field.
func ByGitIdentityID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldGitIdentityID, opts...).ToFunc()
}
// ByImageID orders the results by the image_id field.
func ByImageID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldImageID, 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()
}
// ByUserField orders the results by user field.
func ByUserField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newUserStep(), sql.OrderByField(field, opts...))
}
}
// ByGitIdentityField orders the results by git_identity field.
func ByGitIdentityField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newGitIdentityStep(), sql.OrderByField(field, opts...))
}
}
// ByImageField orders the results by image field.
func ByImageField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newImageStep(), sql.OrderByField(field, opts...))
}
}
// ByIssuesCount orders the results by issues count.
func ByIssuesCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newIssuesStep(), opts...)
}
}
// ByIssues orders the results by issues terms.
func ByIssues(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newIssuesStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
// ByCollaboratorsCount orders the results by collaborators count.
func ByCollaboratorsCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newCollaboratorsStep(), opts...)
}
}
// ByCollaborators orders the results by collaborators terms.
func ByCollaborators(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newCollaboratorsStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
// ByProjectTasksCount orders the results by project_tasks count.
func ByProjectTasksCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newProjectTasksStep(), opts...)
}
}
// ByProjectTasks orders the results by project_tasks terms.
func ByProjectTasks(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newProjectTasksStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
// ByGitBotsCount orders the results by git_bots count.
func ByGitBotsCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newGitBotsStep(), opts...)
}
}
// ByGitBots orders the results by git_bots terms.
func ByGitBots(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newGitBotsStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
// ByProjectGitBotsCount orders the results by project_git_bots count.
func ByProjectGitBotsCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newProjectGitBotsStep(), opts...)
}
}
// ByProjectGitBots orders the results by project_git_bots terms.
func ByProjectGitBots(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newProjectGitBotsStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
func newUserStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(UserInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, UserTable, UserColumn),
)
}
func newGitIdentityStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(GitIdentityInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, GitIdentityTable, GitIdentityColumn),
)
}
func newImageStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(ImageInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, ImageTable, ImageColumn),
)
}
func newIssuesStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(IssuesInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, IssuesTable, IssuesColumn),
)
}
func newCollaboratorsStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(CollaboratorsInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, CollaboratorsTable, CollaboratorsColumn),
)
}
func newProjectTasksStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(ProjectTasksInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, ProjectTasksTable, ProjectTasksColumn),
)
}
func newGitBotsStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(GitBotsInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2M, false, GitBotsTable, GitBotsPrimaryKey...),
)
}
func newProjectGitBotsStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(ProjectGitBotsInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, true, ProjectGitBotsTable, ProjectGitBotsColumn),
)
}