Files
MonkeyCode/backend/db/agentplugin/agentplugin.go

252 lines
9.0 KiB
Go

// Code generated by ent, DO NOT EDIT.
package agentplugin
import (
"fmt"
"time"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"github.com/google/uuid"
)
const (
// Label holds the string label denoting the agentplugin type in the database.
Label = "agent_plugin"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldRepoID holds the string denoting the repo_id field in the database.
FieldRepoID = "repo_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"
// FieldScopeType holds the string denoting the scope_type field in the database.
FieldScopeType = "scope_type"
// FieldScopeID holds the string denoting the scope_id field in the database.
FieldScopeID = "scope_id"
// FieldCreatedBy holds the string denoting the created_by field in the database.
FieldCreatedBy = "created_by"
// FieldActiveVersionID holds the string denoting the active_version_id field in the database.
FieldActiveVersionID = "active_version_id"
// FieldIsForceDelivery holds the string denoting the is_force_delivery field in the database.
FieldIsForceDelivery = "is_force_delivery"
// FieldIsOrphan holds the string denoting the is_orphan field in the database.
FieldIsOrphan = "is_orphan"
// FieldIsDeleted holds the string denoting the is_deleted field in the database.
FieldIsDeleted = "is_deleted"
// FieldEnabled holds the string denoting the enabled field in the database.
FieldEnabled = "enabled"
// 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"
// EdgeRepo holds the string denoting the repo edge name in mutations.
EdgeRepo = "repo"
// EdgeVersions holds the string denoting the versions edge name in mutations.
EdgeVersions = "versions"
// Table holds the table name of the agentplugin in the database.
Table = "agent_plugins"
// RepoTable is the table that holds the repo relation/edge.
RepoTable = "agent_plugins"
// RepoInverseTable is the table name for the AgentPluginRepo entity.
// It exists in this package in order to avoid circular dependency with the "agentpluginrepo" package.
RepoInverseTable = "agent_plugin_repos"
// RepoColumn is the table column denoting the repo relation/edge.
RepoColumn = "repo_id"
// VersionsTable is the table that holds the versions relation/edge.
VersionsTable = "agent_plugin_versions"
// VersionsInverseTable is the table name for the AgentPluginVersion entity.
// It exists in this package in order to avoid circular dependency with the "agentpluginversion" package.
VersionsInverseTable = "agent_plugin_versions"
// VersionsColumn is the table column denoting the versions relation/edge.
VersionsColumn = "resource_id"
)
// Columns holds all SQL columns for agentplugin fields.
var Columns = []string{
FieldID,
FieldRepoID,
FieldName,
FieldDescription,
FieldScopeType,
FieldScopeID,
FieldCreatedBy,
FieldActiveVersionID,
FieldIsForceDelivery,
FieldIsOrphan,
FieldIsDeleted,
FieldEnabled,
FieldCreatedAt,
FieldUpdatedAt,
}
// 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 (
// NameValidator is a validator for the "name" field. It is called by the builders before save.
NameValidator func(string) error
// DefaultScopeID holds the default value on creation for the "scope_id" field.
DefaultScopeID string
// DefaultIsForceDelivery holds the default value on creation for the "is_force_delivery" field.
DefaultIsForceDelivery bool
// DefaultIsOrphan holds the default value on creation for the "is_orphan" field.
DefaultIsOrphan bool
// DefaultIsDeleted holds the default value on creation for the "is_deleted" field.
DefaultIsDeleted bool
// DefaultEnabled holds the default value on creation for the "enabled" field.
DefaultEnabled bool
// 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
// DefaultID holds the default value on creation for the "id" field.
DefaultID func() uuid.UUID
)
// ScopeType defines the type for the "scope_type" enum field.
type ScopeType string
// ScopeTypeGlobal is the default value of the ScopeType enum.
const DefaultScopeType = ScopeTypeGlobal
// ScopeType values.
const (
ScopeTypeGlobal ScopeType = "global"
ScopeTypeTeam ScopeType = "team"
ScopeTypeUser ScopeType = "user"
)
func (st ScopeType) String() string {
return string(st)
}
// ScopeTypeValidator is a validator for the "scope_type" field enum values. It is called by the builders before save.
func ScopeTypeValidator(st ScopeType) error {
switch st {
case ScopeTypeGlobal, ScopeTypeTeam, ScopeTypeUser:
return nil
default:
return fmt.Errorf("agentplugin: invalid enum value for scope_type field: %q", st)
}
}
// OrderOption defines the ordering options for the AgentPlugin 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()
}
// ByRepoID orders the results by the repo_id field.
func ByRepoID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldRepoID, 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()
}
// ByScopeType orders the results by the scope_type field.
func ByScopeType(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldScopeType, opts...).ToFunc()
}
// ByScopeID orders the results by the scope_id field.
func ByScopeID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldScopeID, opts...).ToFunc()
}
// ByCreatedBy orders the results by the created_by field.
func ByCreatedBy(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCreatedBy, opts...).ToFunc()
}
// ByActiveVersionID orders the results by the active_version_id field.
func ByActiveVersionID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldActiveVersionID, opts...).ToFunc()
}
// ByIsForceDelivery orders the results by the is_force_delivery field.
func ByIsForceDelivery(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldIsForceDelivery, opts...).ToFunc()
}
// ByIsOrphan orders the results by the is_orphan field.
func ByIsOrphan(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldIsOrphan, opts...).ToFunc()
}
// ByIsDeleted orders the results by the is_deleted field.
func ByIsDeleted(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldIsDeleted, opts...).ToFunc()
}
// ByEnabled orders the results by the enabled field.
func ByEnabled(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldEnabled, 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()
}
// ByRepoField orders the results by repo field.
func ByRepoField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newRepoStep(), sql.OrderByField(field, opts...))
}
}
// ByVersionsCount orders the results by versions count.
func ByVersionsCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newVersionsStep(), opts...)
}
}
// ByVersions orders the results by versions terms.
func ByVersions(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newVersionsStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
func newRepoStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(RepoInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, RepoTable, RepoColumn),
)
}
func newVersionsStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(VersionsInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, VersionsTable, VersionsColumn),
)
}