Files

224 lines
7.8 KiB
Go

// Code generated by ent, DO NOT EDIT.
package mcptool
import (
"fmt"
"time"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
)
const (
// Label holds the string label denoting the mcptool type in the database.
Label = "mcp_tool"
// 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"
// FieldUpstreamID holds the string denoting the upstream_id field in the database.
FieldUpstreamID = "upstream_id"
// FieldName holds the string denoting the name field in the database.
FieldName = "name"
// FieldNamespacedName holds the string denoting the namespaced_name field in the database.
FieldNamespacedName = "namespaced_name"
// FieldScope holds the string denoting the scope field in the database.
FieldScope = "scope"
// FieldUserID holds the string denoting the user_id field in the database.
FieldUserID = "user_id"
// FieldDescription holds the string denoting the description field in the database.
FieldDescription = "description"
// FieldInputSchema holds the string denoting the input_schema field in the database.
FieldInputSchema = "input_schema"
// FieldPrice holds the string denoting the price field in the database.
FieldPrice = "price"
// FieldEnabled holds the string denoting the enabled field in the database.
FieldEnabled = "enabled"
// FieldVersionHash holds the string denoting the version_hash field in the database.
FieldVersionHash = "version_hash"
// FieldSyncedAt holds the string denoting the synced_at field in the database.
FieldSyncedAt = "synced_at"
// 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"
// EdgeUpstream holds the string denoting the upstream edge name in mutations.
EdgeUpstream = "upstream"
// Table holds the table name of the mcptool in the database.
Table = "mcp_tools"
// UpstreamTable is the table that holds the upstream relation/edge.
UpstreamTable = "mcp_tools"
// UpstreamInverseTable is the table name for the MCPUpstream entity.
// It exists in this package in order to avoid circular dependency with the "mcpupstream" package.
UpstreamInverseTable = "mcp_upstreams"
// UpstreamColumn is the table column denoting the upstream relation/edge.
UpstreamColumn = "upstream_id"
)
// Columns holds all SQL columns for mcptool fields.
var Columns = []string{
FieldID,
FieldDeletedAt,
FieldUpstreamID,
FieldName,
FieldNamespacedName,
FieldScope,
FieldUserID,
FieldDescription,
FieldInputSchema,
FieldPrice,
FieldEnabled,
FieldVersionHash,
FieldSyncedAt,
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
}
// 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
// NamespacedNameValidator is a validator for the "namespaced_name" field. It is called by the builders before save.
NamespacedNameValidator func(string) error
// DefaultPrice holds the default value on creation for the "price" field.
DefaultPrice int64
// DefaultEnabled holds the default value on creation for the "enabled" field.
DefaultEnabled bool
// VersionHashValidator is a validator for the "version_hash" field. It is called by the builders before save.
VersionHashValidator 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
)
// Scope defines the type for the "scope" enum field.
type Scope string
// Scope values.
const (
ScopeUser Scope = "user"
ScopePlatform Scope = "platform"
)
func (s Scope) String() string {
return string(s)
}
// ScopeValidator is a validator for the "scope" field enum values. It is called by the builders before save.
func ScopeValidator(s Scope) error {
switch s {
case ScopeUser, ScopePlatform:
return nil
default:
return fmt.Errorf("mcptool: invalid enum value for scope field: %q", s)
}
}
// OrderOption defines the ordering options for the MCPTool 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()
}
// ByUpstreamID orders the results by the upstream_id field.
func ByUpstreamID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUpstreamID, opts...).ToFunc()
}
// ByName orders the results by the name field.
func ByName(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldName, opts...).ToFunc()
}
// ByNamespacedName orders the results by the namespaced_name field.
func ByNamespacedName(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldNamespacedName, opts...).ToFunc()
}
// ByScope orders the results by the scope field.
func ByScope(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldScope, opts...).ToFunc()
}
// ByUserID orders the results by the user_id field.
func ByUserID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUserID, opts...).ToFunc()
}
// ByDescription orders the results by the description field.
func ByDescription(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDescription, opts...).ToFunc()
}
// ByPrice orders the results by the price field.
func ByPrice(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldPrice, opts...).ToFunc()
}
// ByEnabled orders the results by the enabled field.
func ByEnabled(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldEnabled, opts...).ToFunc()
}
// ByVersionHash orders the results by the version_hash field.
func ByVersionHash(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldVersionHash, opts...).ToFunc()
}
// BySyncedAt orders the results by the synced_at field.
func BySyncedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldSyncedAt, 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()
}
// ByUpstreamField orders the results by upstream field.
func ByUpstreamField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newUpstreamStep(), sql.OrderByField(field, opts...))
}
}
func newUpstreamStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(UpstreamInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, UpstreamTable, UpstreamColumn),
)
}