Files
MonkeyCode/backend/db/gitbotuser/gitbotuser.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 gitbotuser
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 gitbotuser type in the database.
Label = "git_bot_user"
// 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"
// FieldUserID holds the string denoting the user_id field in the database.
FieldUserID = "user_id"
// FieldCreatedAt holds the string denoting the created_at field in the database.
FieldCreatedAt = "created_at"
// EdgeGitBot holds the string denoting the git_bot edge name in mutations.
EdgeGitBot = "git_bot"
// EdgeUser holds the string denoting the user edge name in mutations.
EdgeUser = "user"
// Table holds the table name of the gitbotuser in the database.
Table = "git_bot_users"
// GitBotTable is the table that holds the git_bot relation/edge.
GitBotTable = "git_bot_users"
// 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"
// UserTable is the table that holds the user relation/edge.
UserTable = "git_bot_users"
// 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"
)
// Columns holds all SQL columns for gitbotuser fields.
var Columns = []string{
FieldID,
FieldGitBotID,
FieldUserID,
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 GitBotUser 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()
}
// ByUserID orders the results by the user_id field.
func ByUserID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUserID, opts...).ToFunc()
}
// ByCreatedAt orders the results by the created_at field.
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
}
// 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...))
}
}
// 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...))
}
}
func newGitBotStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(GitBotInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, false, GitBotTable, GitBotColumn),
)
}
func newUserStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(UserInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, false, UserTable, UserColumn),
)
}