chore: 初始化 Cloudreve 源码仓库
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/schema/field"
|
||||
"github.com/cloudreve/Cloudreve/v4/ent/oauthclient"
|
||||
"github.com/cloudreve/Cloudreve/v4/ent/predicate"
|
||||
)
|
||||
|
||||
// OAuthClientDelete is the builder for deleting a OAuthClient entity.
|
||||
type OAuthClientDelete struct {
|
||||
config
|
||||
hooks []Hook
|
||||
mutation *OAuthClientMutation
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the OAuthClientDelete builder.
|
||||
func (ocd *OAuthClientDelete) Where(ps ...predicate.OAuthClient) *OAuthClientDelete {
|
||||
ocd.mutation.Where(ps...)
|
||||
return ocd
|
||||
}
|
||||
|
||||
// Exec executes the deletion query and returns how many vertices were deleted.
|
||||
func (ocd *OAuthClientDelete) Exec(ctx context.Context) (int, error) {
|
||||
return withHooks(ctx, ocd.sqlExec, ocd.mutation, ocd.hooks)
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (ocd *OAuthClientDelete) ExecX(ctx context.Context) int {
|
||||
n, err := ocd.Exec(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (ocd *OAuthClientDelete) sqlExec(ctx context.Context) (int, error) {
|
||||
_spec := sqlgraph.NewDeleteSpec(oauthclient.Table, sqlgraph.NewFieldSpec(oauthclient.FieldID, field.TypeInt))
|
||||
if ps := ocd.mutation.predicates; len(ps) > 0 {
|
||||
_spec.Predicate = func(selector *sql.Selector) {
|
||||
for i := range ps {
|
||||
ps[i](selector)
|
||||
}
|
||||
}
|
||||
}
|
||||
affected, err := sqlgraph.DeleteNodes(ctx, ocd.driver, _spec)
|
||||
if err != nil && sqlgraph.IsConstraintError(err) {
|
||||
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||
}
|
||||
ocd.mutation.done = true
|
||||
return affected, err
|
||||
}
|
||||
|
||||
// OAuthClientDeleteOne is the builder for deleting a single OAuthClient entity.
|
||||
type OAuthClientDeleteOne struct {
|
||||
ocd *OAuthClientDelete
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the OAuthClientDelete builder.
|
||||
func (ocdo *OAuthClientDeleteOne) Where(ps ...predicate.OAuthClient) *OAuthClientDeleteOne {
|
||||
ocdo.ocd.mutation.Where(ps...)
|
||||
return ocdo
|
||||
}
|
||||
|
||||
// Exec executes the deletion query.
|
||||
func (ocdo *OAuthClientDeleteOne) Exec(ctx context.Context) error {
|
||||
n, err := ocdo.ocd.Exec(ctx)
|
||||
switch {
|
||||
case err != nil:
|
||||
return err
|
||||
case n == 0:
|
||||
return &NotFoundError{oauthclient.Label}
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (ocdo *OAuthClientDeleteOne) ExecX(ctx context.Context) {
|
||||
if err := ocdo.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user