You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cloudreve/ent/oauthclient/oauthclient.go

180 lines
6.5 KiB

// Code generated by ent, DO NOT EDIT.
package oauthclient
import (
"time"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"github.com/cloudreve/Cloudreve/v4/inventory/types"
)
const (
// Label holds the string label denoting the oauthclient type in the database.
Label = "oauth_client"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// 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"
// FieldDeletedAt holds the string denoting the deleted_at field in the database.
FieldDeletedAt = "deleted_at"
// FieldGUID holds the string denoting the guid field in the database.
FieldGUID = "guid"
// FieldSecret holds the string denoting the secret field in the database.
FieldSecret = "secret"
// FieldName holds the string denoting the name field in the database.
FieldName = "name"
// FieldHomepageURL holds the string denoting the homepage_url field in the database.
FieldHomepageURL = "homepage_url"
// FieldRedirectUris holds the string denoting the redirect_uris field in the database.
FieldRedirectUris = "redirect_uris"
// FieldScopes holds the string denoting the scopes field in the database.
FieldScopes = "scopes"
// FieldProps holds the string denoting the props field in the database.
FieldProps = "props"
// FieldIsEnabled holds the string denoting the is_enabled field in the database.
FieldIsEnabled = "is_enabled"
// EdgeGrants holds the string denoting the grants edge name in mutations.
EdgeGrants = "grants"
// Table holds the table name of the oauthclient in the database.
Table = "oauth_clients"
// GrantsTable is the table that holds the grants relation/edge.
GrantsTable = "oauth_grants"
// GrantsInverseTable is the table name for the OAuthGrant entity.
// It exists in this package in order to avoid circular dependency with the "oauthgrant" package.
GrantsInverseTable = "oauth_grants"
// GrantsColumn is the table column denoting the grants relation/edge.
GrantsColumn = "client_id"
)
// Columns holds all SQL columns for oauthclient fields.
var Columns = []string{
FieldID,
FieldCreatedAt,
FieldUpdatedAt,
FieldDeletedAt,
FieldGUID,
FieldSecret,
FieldName,
FieldHomepageURL,
FieldRedirectUris,
FieldScopes,
FieldProps,
FieldIsEnabled,
}
// 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/cloudreve/Cloudreve/v4/ent/runtime"
var (
Hooks [1]ent.Hook
Interceptors [1]ent.Interceptor
// 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
// GUIDValidator is a validator for the "guid" field. It is called by the builders before save.
GUIDValidator func(string) error
// SecretValidator is a validator for the "secret" field. It is called by the builders before save.
SecretValidator func(string) error
// NameValidator is a validator for the "name" field. It is called by the builders before save.
NameValidator func(string) error
// HomepageURLValidator is a validator for the "homepage_url" field. It is called by the builders before save.
HomepageURLValidator func(string) error
// DefaultRedirectUris holds the default value on creation for the "redirect_uris" field.
DefaultRedirectUris []string
// DefaultScopes holds the default value on creation for the "scopes" field.
DefaultScopes []string
// DefaultProps holds the default value on creation for the "props" field.
DefaultProps *types.OAuthClientProps
// DefaultIsEnabled holds the default value on creation for the "is_enabled" field.
DefaultIsEnabled bool
)
// OrderOption defines the ordering options for the OAuthClient 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()
}
// 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()
}
// ByDeletedAt orders the results by the deleted_at field.
func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
}
// ByGUID orders the results by the guid field.
func ByGUID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldGUID, opts...).ToFunc()
}
// BySecret orders the results by the secret field.
func BySecret(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldSecret, opts...).ToFunc()
}
// ByName orders the results by the name field.
func ByName(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldName, opts...).ToFunc()
}
// ByHomepageURL orders the results by the homepage_url field.
func ByHomepageURL(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldHomepageURL, opts...).ToFunc()
}
// ByIsEnabled orders the results by the is_enabled field.
func ByIsEnabled(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldIsEnabled, opts...).ToFunc()
}
// ByGrantsCount orders the results by grants count.
func ByGrantsCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newGrantsStep(), opts...)
}
}
// ByGrants orders the results by grants terms.
func ByGrants(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newGrantsStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
func newGrantsStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(GrantsInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, GrantsTable, GrantsColumn),
)
}