mirror of
https://github.com/hanzoui/registry-backend.git
synced 2026-10-30 20:30:45 +00:00
* Change normalized_id field to mandatory * add atlas migration file --------- Co-authored-by: James Kwon <[email protected]>
1743 lines
49 KiB
Go
1743 lines
49 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package ent
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"fmt"
|
|
"registry-backend/ent/node"
|
|
"registry-backend/ent/nodereview"
|
|
"registry-backend/ent/nodeversion"
|
|
"registry-backend/ent/publisher"
|
|
"registry-backend/ent/schema"
|
|
"time"
|
|
|
|
"entgo.io/ent/dialect"
|
|
"entgo.io/ent/dialect/sql"
|
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
|
"entgo.io/ent/schema/field"
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
// NodeCreate is the builder for creating a Node entity.
|
|
type NodeCreate struct {
|
|
config
|
|
mutation *NodeMutation
|
|
hooks []Hook
|
|
conflict []sql.ConflictOption
|
|
}
|
|
|
|
// SetCreateTime sets the "create_time" field.
|
|
func (nc *NodeCreate) SetCreateTime(t time.Time) *NodeCreate {
|
|
nc.mutation.SetCreateTime(t)
|
|
return nc
|
|
}
|
|
|
|
// SetNillableCreateTime sets the "create_time" field if the given value is not nil.
|
|
func (nc *NodeCreate) SetNillableCreateTime(t *time.Time) *NodeCreate {
|
|
if t != nil {
|
|
nc.SetCreateTime(*t)
|
|
}
|
|
return nc
|
|
}
|
|
|
|
// SetUpdateTime sets the "update_time" field.
|
|
func (nc *NodeCreate) SetUpdateTime(t time.Time) *NodeCreate {
|
|
nc.mutation.SetUpdateTime(t)
|
|
return nc
|
|
}
|
|
|
|
// SetNillableUpdateTime sets the "update_time" field if the given value is not nil.
|
|
func (nc *NodeCreate) SetNillableUpdateTime(t *time.Time) *NodeCreate {
|
|
if t != nil {
|
|
nc.SetUpdateTime(*t)
|
|
}
|
|
return nc
|
|
}
|
|
|
|
// SetNormalizedID sets the "normalized_id" field.
|
|
func (nc *NodeCreate) SetNormalizedID(s string) *NodeCreate {
|
|
nc.mutation.SetNormalizedID(s)
|
|
return nc
|
|
}
|
|
|
|
// SetPublisherID sets the "publisher_id" field.
|
|
func (nc *NodeCreate) SetPublisherID(s string) *NodeCreate {
|
|
nc.mutation.SetPublisherID(s)
|
|
return nc
|
|
}
|
|
|
|
// SetName sets the "name" field.
|
|
func (nc *NodeCreate) SetName(s string) *NodeCreate {
|
|
nc.mutation.SetName(s)
|
|
return nc
|
|
}
|
|
|
|
// SetDescription sets the "description" field.
|
|
func (nc *NodeCreate) SetDescription(s string) *NodeCreate {
|
|
nc.mutation.SetDescription(s)
|
|
return nc
|
|
}
|
|
|
|
// SetNillableDescription sets the "description" field if the given value is not nil.
|
|
func (nc *NodeCreate) SetNillableDescription(s *string) *NodeCreate {
|
|
if s != nil {
|
|
nc.SetDescription(*s)
|
|
}
|
|
return nc
|
|
}
|
|
|
|
// SetCategory sets the "category" field.
|
|
func (nc *NodeCreate) SetCategory(s string) *NodeCreate {
|
|
nc.mutation.SetCategory(s)
|
|
return nc
|
|
}
|
|
|
|
// SetNillableCategory sets the "category" field if the given value is not nil.
|
|
func (nc *NodeCreate) SetNillableCategory(s *string) *NodeCreate {
|
|
if s != nil {
|
|
nc.SetCategory(*s)
|
|
}
|
|
return nc
|
|
}
|
|
|
|
// SetAuthor sets the "author" field.
|
|
func (nc *NodeCreate) SetAuthor(s string) *NodeCreate {
|
|
nc.mutation.SetAuthor(s)
|
|
return nc
|
|
}
|
|
|
|
// SetNillableAuthor sets the "author" field if the given value is not nil.
|
|
func (nc *NodeCreate) SetNillableAuthor(s *string) *NodeCreate {
|
|
if s != nil {
|
|
nc.SetAuthor(*s)
|
|
}
|
|
return nc
|
|
}
|
|
|
|
// SetLicense sets the "license" field.
|
|
func (nc *NodeCreate) SetLicense(s string) *NodeCreate {
|
|
nc.mutation.SetLicense(s)
|
|
return nc
|
|
}
|
|
|
|
// SetRepositoryURL sets the "repository_url" field.
|
|
func (nc *NodeCreate) SetRepositoryURL(s string) *NodeCreate {
|
|
nc.mutation.SetRepositoryURL(s)
|
|
return nc
|
|
}
|
|
|
|
// SetIconURL sets the "icon_url" field.
|
|
func (nc *NodeCreate) SetIconURL(s string) *NodeCreate {
|
|
nc.mutation.SetIconURL(s)
|
|
return nc
|
|
}
|
|
|
|
// SetNillableIconURL sets the "icon_url" field if the given value is not nil.
|
|
func (nc *NodeCreate) SetNillableIconURL(s *string) *NodeCreate {
|
|
if s != nil {
|
|
nc.SetIconURL(*s)
|
|
}
|
|
return nc
|
|
}
|
|
|
|
// SetTags sets the "tags" field.
|
|
func (nc *NodeCreate) SetTags(s []string) *NodeCreate {
|
|
nc.mutation.SetTags(s)
|
|
return nc
|
|
}
|
|
|
|
// SetTotalInstall sets the "total_install" field.
|
|
func (nc *NodeCreate) SetTotalInstall(i int64) *NodeCreate {
|
|
nc.mutation.SetTotalInstall(i)
|
|
return nc
|
|
}
|
|
|
|
// SetNillableTotalInstall sets the "total_install" field if the given value is not nil.
|
|
func (nc *NodeCreate) SetNillableTotalInstall(i *int64) *NodeCreate {
|
|
if i != nil {
|
|
nc.SetTotalInstall(*i)
|
|
}
|
|
return nc
|
|
}
|
|
|
|
// SetTotalStar sets the "total_star" field.
|
|
func (nc *NodeCreate) SetTotalStar(i int64) *NodeCreate {
|
|
nc.mutation.SetTotalStar(i)
|
|
return nc
|
|
}
|
|
|
|
// SetNillableTotalStar sets the "total_star" field if the given value is not nil.
|
|
func (nc *NodeCreate) SetNillableTotalStar(i *int64) *NodeCreate {
|
|
if i != nil {
|
|
nc.SetTotalStar(*i)
|
|
}
|
|
return nc
|
|
}
|
|
|
|
// SetTotalReview sets the "total_review" field.
|
|
func (nc *NodeCreate) SetTotalReview(i int64) *NodeCreate {
|
|
nc.mutation.SetTotalReview(i)
|
|
return nc
|
|
}
|
|
|
|
// SetNillableTotalReview sets the "total_review" field if the given value is not nil.
|
|
func (nc *NodeCreate) SetNillableTotalReview(i *int64) *NodeCreate {
|
|
if i != nil {
|
|
nc.SetTotalReview(*i)
|
|
}
|
|
return nc
|
|
}
|
|
|
|
// SetStatus sets the "status" field.
|
|
func (nc *NodeCreate) SetStatus(ss schema.NodeStatus) *NodeCreate {
|
|
nc.mutation.SetStatus(ss)
|
|
return nc
|
|
}
|
|
|
|
// SetNillableStatus sets the "status" field if the given value is not nil.
|
|
func (nc *NodeCreate) SetNillableStatus(ss *schema.NodeStatus) *NodeCreate {
|
|
if ss != nil {
|
|
nc.SetStatus(*ss)
|
|
}
|
|
return nc
|
|
}
|
|
|
|
// SetStatusDetail sets the "status_detail" field.
|
|
func (nc *NodeCreate) SetStatusDetail(s string) *NodeCreate {
|
|
nc.mutation.SetStatusDetail(s)
|
|
return nc
|
|
}
|
|
|
|
// SetNillableStatusDetail sets the "status_detail" field if the given value is not nil.
|
|
func (nc *NodeCreate) SetNillableStatusDetail(s *string) *NodeCreate {
|
|
if s != nil {
|
|
nc.SetStatusDetail(*s)
|
|
}
|
|
return nc
|
|
}
|
|
|
|
// SetLastAlgoliaIndexTime sets the "last_algolia_index_time" field.
|
|
func (nc *NodeCreate) SetLastAlgoliaIndexTime(t time.Time) *NodeCreate {
|
|
nc.mutation.SetLastAlgoliaIndexTime(t)
|
|
return nc
|
|
}
|
|
|
|
// SetNillableLastAlgoliaIndexTime sets the "last_algolia_index_time" field if the given value is not nil.
|
|
func (nc *NodeCreate) SetNillableLastAlgoliaIndexTime(t *time.Time) *NodeCreate {
|
|
if t != nil {
|
|
nc.SetLastAlgoliaIndexTime(*t)
|
|
}
|
|
return nc
|
|
}
|
|
|
|
// SetID sets the "id" field.
|
|
func (nc *NodeCreate) SetID(s string) *NodeCreate {
|
|
nc.mutation.SetID(s)
|
|
return nc
|
|
}
|
|
|
|
// SetPublisher sets the "publisher" edge to the Publisher entity.
|
|
func (nc *NodeCreate) SetPublisher(p *Publisher) *NodeCreate {
|
|
return nc.SetPublisherID(p.ID)
|
|
}
|
|
|
|
// AddVersionIDs adds the "versions" edge to the NodeVersion entity by IDs.
|
|
func (nc *NodeCreate) AddVersionIDs(ids ...uuid.UUID) *NodeCreate {
|
|
nc.mutation.AddVersionIDs(ids...)
|
|
return nc
|
|
}
|
|
|
|
// AddVersions adds the "versions" edges to the NodeVersion entity.
|
|
func (nc *NodeCreate) AddVersions(n ...*NodeVersion) *NodeCreate {
|
|
ids := make([]uuid.UUID, len(n))
|
|
for i := range n {
|
|
ids[i] = n[i].ID
|
|
}
|
|
return nc.AddVersionIDs(ids...)
|
|
}
|
|
|
|
// AddReviewIDs adds the "reviews" edge to the NodeReview entity by IDs.
|
|
func (nc *NodeCreate) AddReviewIDs(ids ...uuid.UUID) *NodeCreate {
|
|
nc.mutation.AddReviewIDs(ids...)
|
|
return nc
|
|
}
|
|
|
|
// AddReviews adds the "reviews" edges to the NodeReview entity.
|
|
func (nc *NodeCreate) AddReviews(n ...*NodeReview) *NodeCreate {
|
|
ids := make([]uuid.UUID, len(n))
|
|
for i := range n {
|
|
ids[i] = n[i].ID
|
|
}
|
|
return nc.AddReviewIDs(ids...)
|
|
}
|
|
|
|
// Mutation returns the NodeMutation object of the builder.
|
|
func (nc *NodeCreate) Mutation() *NodeMutation {
|
|
return nc.mutation
|
|
}
|
|
|
|
// Save creates the Node in the database.
|
|
func (nc *NodeCreate) Save(ctx context.Context) (*Node, error) {
|
|
nc.defaults()
|
|
return withHooks(ctx, nc.sqlSave, nc.mutation, nc.hooks)
|
|
}
|
|
|
|
// SaveX calls Save and panics if Save returns an error.
|
|
func (nc *NodeCreate) SaveX(ctx context.Context) *Node {
|
|
v, err := nc.Save(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return v
|
|
}
|
|
|
|
// Exec executes the query.
|
|
func (nc *NodeCreate) Exec(ctx context.Context) error {
|
|
_, err := nc.Save(ctx)
|
|
return err
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (nc *NodeCreate) ExecX(ctx context.Context) {
|
|
if err := nc.Exec(ctx); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
// defaults sets the default values of the builder before save.
|
|
func (nc *NodeCreate) defaults() {
|
|
if _, ok := nc.mutation.CreateTime(); !ok {
|
|
v := node.DefaultCreateTime()
|
|
nc.mutation.SetCreateTime(v)
|
|
}
|
|
if _, ok := nc.mutation.UpdateTime(); !ok {
|
|
v := node.DefaultUpdateTime()
|
|
nc.mutation.SetUpdateTime(v)
|
|
}
|
|
if _, ok := nc.mutation.Tags(); !ok {
|
|
v := node.DefaultTags
|
|
nc.mutation.SetTags(v)
|
|
}
|
|
if _, ok := nc.mutation.TotalInstall(); !ok {
|
|
v := node.DefaultTotalInstall
|
|
nc.mutation.SetTotalInstall(v)
|
|
}
|
|
if _, ok := nc.mutation.TotalStar(); !ok {
|
|
v := node.DefaultTotalStar
|
|
nc.mutation.SetTotalStar(v)
|
|
}
|
|
if _, ok := nc.mutation.TotalReview(); !ok {
|
|
v := node.DefaultTotalReview
|
|
nc.mutation.SetTotalReview(v)
|
|
}
|
|
if _, ok := nc.mutation.Status(); !ok {
|
|
v := node.DefaultStatus
|
|
nc.mutation.SetStatus(v)
|
|
}
|
|
}
|
|
|
|
// check runs all checks and user-defined validators on the builder.
|
|
func (nc *NodeCreate) check() error {
|
|
if _, ok := nc.mutation.CreateTime(); !ok {
|
|
return &ValidationError{Name: "create_time", err: errors.New(`ent: missing required field "Node.create_time"`)}
|
|
}
|
|
if _, ok := nc.mutation.UpdateTime(); !ok {
|
|
return &ValidationError{Name: "update_time", err: errors.New(`ent: missing required field "Node.update_time"`)}
|
|
}
|
|
if _, ok := nc.mutation.NormalizedID(); !ok {
|
|
return &ValidationError{Name: "normalized_id", err: errors.New(`ent: missing required field "Node.normalized_id"`)}
|
|
}
|
|
if _, ok := nc.mutation.PublisherID(); !ok {
|
|
return &ValidationError{Name: "publisher_id", err: errors.New(`ent: missing required field "Node.publisher_id"`)}
|
|
}
|
|
if _, ok := nc.mutation.Name(); !ok {
|
|
return &ValidationError{Name: "name", err: errors.New(`ent: missing required field "Node.name"`)}
|
|
}
|
|
if _, ok := nc.mutation.License(); !ok {
|
|
return &ValidationError{Name: "license", err: errors.New(`ent: missing required field "Node.license"`)}
|
|
}
|
|
if _, ok := nc.mutation.RepositoryURL(); !ok {
|
|
return &ValidationError{Name: "repository_url", err: errors.New(`ent: missing required field "Node.repository_url"`)}
|
|
}
|
|
if _, ok := nc.mutation.Tags(); !ok {
|
|
return &ValidationError{Name: "tags", err: errors.New(`ent: missing required field "Node.tags"`)}
|
|
}
|
|
if _, ok := nc.mutation.TotalInstall(); !ok {
|
|
return &ValidationError{Name: "total_install", err: errors.New(`ent: missing required field "Node.total_install"`)}
|
|
}
|
|
if _, ok := nc.mutation.TotalStar(); !ok {
|
|
return &ValidationError{Name: "total_star", err: errors.New(`ent: missing required field "Node.total_star"`)}
|
|
}
|
|
if _, ok := nc.mutation.TotalReview(); !ok {
|
|
return &ValidationError{Name: "total_review", err: errors.New(`ent: missing required field "Node.total_review"`)}
|
|
}
|
|
if _, ok := nc.mutation.Status(); !ok {
|
|
return &ValidationError{Name: "status", err: errors.New(`ent: missing required field "Node.status"`)}
|
|
}
|
|
if v, ok := nc.mutation.Status(); ok {
|
|
if err := node.StatusValidator(v); err != nil {
|
|
return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "Node.status": %w`, err)}
|
|
}
|
|
}
|
|
if len(nc.mutation.PublisherIDs()) == 0 {
|
|
return &ValidationError{Name: "publisher", err: errors.New(`ent: missing required edge "Node.publisher"`)}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (nc *NodeCreate) sqlSave(ctx context.Context) (*Node, error) {
|
|
if err := nc.check(); err != nil {
|
|
return nil, err
|
|
}
|
|
_node, _spec := nc.createSpec()
|
|
if err := sqlgraph.CreateNode(ctx, nc.driver, _spec); err != nil {
|
|
if sqlgraph.IsConstraintError(err) {
|
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
|
}
|
|
return nil, err
|
|
}
|
|
if _spec.ID.Value != nil {
|
|
if id, ok := _spec.ID.Value.(string); ok {
|
|
_node.ID = id
|
|
} else {
|
|
return nil, fmt.Errorf("unexpected Node.ID type: %T", _spec.ID.Value)
|
|
}
|
|
}
|
|
nc.mutation.id = &_node.ID
|
|
nc.mutation.done = true
|
|
return _node, nil
|
|
}
|
|
|
|
func (nc *NodeCreate) createSpec() (*Node, *sqlgraph.CreateSpec) {
|
|
var (
|
|
_node = &Node{config: nc.config}
|
|
_spec = sqlgraph.NewCreateSpec(node.Table, sqlgraph.NewFieldSpec(node.FieldID, field.TypeString))
|
|
)
|
|
_spec.OnConflict = nc.conflict
|
|
if id, ok := nc.mutation.ID(); ok {
|
|
_node.ID = id
|
|
_spec.ID.Value = id
|
|
}
|
|
if value, ok := nc.mutation.CreateTime(); ok {
|
|
_spec.SetField(node.FieldCreateTime, field.TypeTime, value)
|
|
_node.CreateTime = value
|
|
}
|
|
if value, ok := nc.mutation.UpdateTime(); ok {
|
|
_spec.SetField(node.FieldUpdateTime, field.TypeTime, value)
|
|
_node.UpdateTime = value
|
|
}
|
|
if value, ok := nc.mutation.NormalizedID(); ok {
|
|
_spec.SetField(node.FieldNormalizedID, field.TypeString, value)
|
|
_node.NormalizedID = value
|
|
}
|
|
if value, ok := nc.mutation.Name(); ok {
|
|
_spec.SetField(node.FieldName, field.TypeString, value)
|
|
_node.Name = value
|
|
}
|
|
if value, ok := nc.mutation.Description(); ok {
|
|
_spec.SetField(node.FieldDescription, field.TypeString, value)
|
|
_node.Description = value
|
|
}
|
|
if value, ok := nc.mutation.Category(); ok {
|
|
_spec.SetField(node.FieldCategory, field.TypeString, value)
|
|
_node.Category = value
|
|
}
|
|
if value, ok := nc.mutation.Author(); ok {
|
|
_spec.SetField(node.FieldAuthor, field.TypeString, value)
|
|
_node.Author = value
|
|
}
|
|
if value, ok := nc.mutation.License(); ok {
|
|
_spec.SetField(node.FieldLicense, field.TypeString, value)
|
|
_node.License = value
|
|
}
|
|
if value, ok := nc.mutation.RepositoryURL(); ok {
|
|
_spec.SetField(node.FieldRepositoryURL, field.TypeString, value)
|
|
_node.RepositoryURL = value
|
|
}
|
|
if value, ok := nc.mutation.IconURL(); ok {
|
|
_spec.SetField(node.FieldIconURL, field.TypeString, value)
|
|
_node.IconURL = value
|
|
}
|
|
if value, ok := nc.mutation.Tags(); ok {
|
|
_spec.SetField(node.FieldTags, field.TypeJSON, value)
|
|
_node.Tags = value
|
|
}
|
|
if value, ok := nc.mutation.TotalInstall(); ok {
|
|
_spec.SetField(node.FieldTotalInstall, field.TypeInt64, value)
|
|
_node.TotalInstall = value
|
|
}
|
|
if value, ok := nc.mutation.TotalStar(); ok {
|
|
_spec.SetField(node.FieldTotalStar, field.TypeInt64, value)
|
|
_node.TotalStar = value
|
|
}
|
|
if value, ok := nc.mutation.TotalReview(); ok {
|
|
_spec.SetField(node.FieldTotalReview, field.TypeInt64, value)
|
|
_node.TotalReview = value
|
|
}
|
|
if value, ok := nc.mutation.Status(); ok {
|
|
_spec.SetField(node.FieldStatus, field.TypeEnum, value)
|
|
_node.Status = value
|
|
}
|
|
if value, ok := nc.mutation.StatusDetail(); ok {
|
|
_spec.SetField(node.FieldStatusDetail, field.TypeString, value)
|
|
_node.StatusDetail = value
|
|
}
|
|
if value, ok := nc.mutation.LastAlgoliaIndexTime(); ok {
|
|
_spec.SetField(node.FieldLastAlgoliaIndexTime, field.TypeTime, value)
|
|
_node.LastAlgoliaIndexTime = value
|
|
}
|
|
if nodes := nc.mutation.PublisherIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: true,
|
|
Table: node.PublisherTable,
|
|
Columns: []string{node.PublisherColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(publisher.FieldID, field.TypeString),
|
|
},
|
|
}
|
|
for _, k := range nodes {
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
}
|
|
_node.PublisherID = nodes[0]
|
|
_spec.Edges = append(_spec.Edges, edge)
|
|
}
|
|
if nodes := nc.mutation.VersionsIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.O2M,
|
|
Inverse: false,
|
|
Table: node.VersionsTable,
|
|
Columns: []string{node.VersionsColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(nodeversion.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
for _, k := range nodes {
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
}
|
|
_spec.Edges = append(_spec.Edges, edge)
|
|
}
|
|
if nodes := nc.mutation.ReviewsIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.O2M,
|
|
Inverse: false,
|
|
Table: node.ReviewsTable,
|
|
Columns: []string{node.ReviewsColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(nodereview.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
for _, k := range nodes {
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
}
|
|
_spec.Edges = append(_spec.Edges, edge)
|
|
}
|
|
return _node, _spec
|
|
}
|
|
|
|
// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
|
|
// of the `INSERT` statement. For example:
|
|
//
|
|
// client.Node.Create().
|
|
// SetCreateTime(v).
|
|
// OnConflict(
|
|
// // Update the row with the new values
|
|
// // the was proposed for insertion.
|
|
// sql.ResolveWithNewValues(),
|
|
// ).
|
|
// // Override some of the fields with custom
|
|
// // update values.
|
|
// Update(func(u *ent.NodeUpsert) {
|
|
// SetCreateTime(v+v).
|
|
// }).
|
|
// Exec(ctx)
|
|
func (nc *NodeCreate) OnConflict(opts ...sql.ConflictOption) *NodeUpsertOne {
|
|
nc.conflict = opts
|
|
return &NodeUpsertOne{
|
|
create: nc,
|
|
}
|
|
}
|
|
|
|
// OnConflictColumns calls `OnConflict` and configures the columns
|
|
// as conflict target. Using this option is equivalent to using:
|
|
//
|
|
// client.Node.Create().
|
|
// OnConflict(sql.ConflictColumns(columns...)).
|
|
// Exec(ctx)
|
|
func (nc *NodeCreate) OnConflictColumns(columns ...string) *NodeUpsertOne {
|
|
nc.conflict = append(nc.conflict, sql.ConflictColumns(columns...))
|
|
return &NodeUpsertOne{
|
|
create: nc,
|
|
}
|
|
}
|
|
|
|
type (
|
|
// NodeUpsertOne is the builder for "upsert"-ing
|
|
// one Node node.
|
|
NodeUpsertOne struct {
|
|
create *NodeCreate
|
|
}
|
|
|
|
// NodeUpsert is the "OnConflict" setter.
|
|
NodeUpsert struct {
|
|
*sql.UpdateSet
|
|
}
|
|
)
|
|
|
|
// SetUpdateTime sets the "update_time" field.
|
|
func (u *NodeUpsert) SetUpdateTime(v time.Time) *NodeUpsert {
|
|
u.Set(node.FieldUpdateTime, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateUpdateTime sets the "update_time" field to the value that was provided on create.
|
|
func (u *NodeUpsert) UpdateUpdateTime() *NodeUpsert {
|
|
u.SetExcluded(node.FieldUpdateTime)
|
|
return u
|
|
}
|
|
|
|
// SetNormalizedID sets the "normalized_id" field.
|
|
func (u *NodeUpsert) SetNormalizedID(v string) *NodeUpsert {
|
|
u.Set(node.FieldNormalizedID, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateNormalizedID sets the "normalized_id" field to the value that was provided on create.
|
|
func (u *NodeUpsert) UpdateNormalizedID() *NodeUpsert {
|
|
u.SetExcluded(node.FieldNormalizedID)
|
|
return u
|
|
}
|
|
|
|
// SetPublisherID sets the "publisher_id" field.
|
|
func (u *NodeUpsert) SetPublisherID(v string) *NodeUpsert {
|
|
u.Set(node.FieldPublisherID, v)
|
|
return u
|
|
}
|
|
|
|
// UpdatePublisherID sets the "publisher_id" field to the value that was provided on create.
|
|
func (u *NodeUpsert) UpdatePublisherID() *NodeUpsert {
|
|
u.SetExcluded(node.FieldPublisherID)
|
|
return u
|
|
}
|
|
|
|
// SetName sets the "name" field.
|
|
func (u *NodeUpsert) SetName(v string) *NodeUpsert {
|
|
u.Set(node.FieldName, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateName sets the "name" field to the value that was provided on create.
|
|
func (u *NodeUpsert) UpdateName() *NodeUpsert {
|
|
u.SetExcluded(node.FieldName)
|
|
return u
|
|
}
|
|
|
|
// SetDescription sets the "description" field.
|
|
func (u *NodeUpsert) SetDescription(v string) *NodeUpsert {
|
|
u.Set(node.FieldDescription, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateDescription sets the "description" field to the value that was provided on create.
|
|
func (u *NodeUpsert) UpdateDescription() *NodeUpsert {
|
|
u.SetExcluded(node.FieldDescription)
|
|
return u
|
|
}
|
|
|
|
// ClearDescription clears the value of the "description" field.
|
|
func (u *NodeUpsert) ClearDescription() *NodeUpsert {
|
|
u.SetNull(node.FieldDescription)
|
|
return u
|
|
}
|
|
|
|
// SetCategory sets the "category" field.
|
|
func (u *NodeUpsert) SetCategory(v string) *NodeUpsert {
|
|
u.Set(node.FieldCategory, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateCategory sets the "category" field to the value that was provided on create.
|
|
func (u *NodeUpsert) UpdateCategory() *NodeUpsert {
|
|
u.SetExcluded(node.FieldCategory)
|
|
return u
|
|
}
|
|
|
|
// ClearCategory clears the value of the "category" field.
|
|
func (u *NodeUpsert) ClearCategory() *NodeUpsert {
|
|
u.SetNull(node.FieldCategory)
|
|
return u
|
|
}
|
|
|
|
// SetAuthor sets the "author" field.
|
|
func (u *NodeUpsert) SetAuthor(v string) *NodeUpsert {
|
|
u.Set(node.FieldAuthor, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateAuthor sets the "author" field to the value that was provided on create.
|
|
func (u *NodeUpsert) UpdateAuthor() *NodeUpsert {
|
|
u.SetExcluded(node.FieldAuthor)
|
|
return u
|
|
}
|
|
|
|
// ClearAuthor clears the value of the "author" field.
|
|
func (u *NodeUpsert) ClearAuthor() *NodeUpsert {
|
|
u.SetNull(node.FieldAuthor)
|
|
return u
|
|
}
|
|
|
|
// SetLicense sets the "license" field.
|
|
func (u *NodeUpsert) SetLicense(v string) *NodeUpsert {
|
|
u.Set(node.FieldLicense, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateLicense sets the "license" field to the value that was provided on create.
|
|
func (u *NodeUpsert) UpdateLicense() *NodeUpsert {
|
|
u.SetExcluded(node.FieldLicense)
|
|
return u
|
|
}
|
|
|
|
// SetRepositoryURL sets the "repository_url" field.
|
|
func (u *NodeUpsert) SetRepositoryURL(v string) *NodeUpsert {
|
|
u.Set(node.FieldRepositoryURL, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateRepositoryURL sets the "repository_url" field to the value that was provided on create.
|
|
func (u *NodeUpsert) UpdateRepositoryURL() *NodeUpsert {
|
|
u.SetExcluded(node.FieldRepositoryURL)
|
|
return u
|
|
}
|
|
|
|
// SetIconURL sets the "icon_url" field.
|
|
func (u *NodeUpsert) SetIconURL(v string) *NodeUpsert {
|
|
u.Set(node.FieldIconURL, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateIconURL sets the "icon_url" field to the value that was provided on create.
|
|
func (u *NodeUpsert) UpdateIconURL() *NodeUpsert {
|
|
u.SetExcluded(node.FieldIconURL)
|
|
return u
|
|
}
|
|
|
|
// ClearIconURL clears the value of the "icon_url" field.
|
|
func (u *NodeUpsert) ClearIconURL() *NodeUpsert {
|
|
u.SetNull(node.FieldIconURL)
|
|
return u
|
|
}
|
|
|
|
// SetTags sets the "tags" field.
|
|
func (u *NodeUpsert) SetTags(v []string) *NodeUpsert {
|
|
u.Set(node.FieldTags, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateTags sets the "tags" field to the value that was provided on create.
|
|
func (u *NodeUpsert) UpdateTags() *NodeUpsert {
|
|
u.SetExcluded(node.FieldTags)
|
|
return u
|
|
}
|
|
|
|
// SetTotalInstall sets the "total_install" field.
|
|
func (u *NodeUpsert) SetTotalInstall(v int64) *NodeUpsert {
|
|
u.Set(node.FieldTotalInstall, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateTotalInstall sets the "total_install" field to the value that was provided on create.
|
|
func (u *NodeUpsert) UpdateTotalInstall() *NodeUpsert {
|
|
u.SetExcluded(node.FieldTotalInstall)
|
|
return u
|
|
}
|
|
|
|
// AddTotalInstall adds v to the "total_install" field.
|
|
func (u *NodeUpsert) AddTotalInstall(v int64) *NodeUpsert {
|
|
u.Add(node.FieldTotalInstall, v)
|
|
return u
|
|
}
|
|
|
|
// SetTotalStar sets the "total_star" field.
|
|
func (u *NodeUpsert) SetTotalStar(v int64) *NodeUpsert {
|
|
u.Set(node.FieldTotalStar, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateTotalStar sets the "total_star" field to the value that was provided on create.
|
|
func (u *NodeUpsert) UpdateTotalStar() *NodeUpsert {
|
|
u.SetExcluded(node.FieldTotalStar)
|
|
return u
|
|
}
|
|
|
|
// AddTotalStar adds v to the "total_star" field.
|
|
func (u *NodeUpsert) AddTotalStar(v int64) *NodeUpsert {
|
|
u.Add(node.FieldTotalStar, v)
|
|
return u
|
|
}
|
|
|
|
// SetTotalReview sets the "total_review" field.
|
|
func (u *NodeUpsert) SetTotalReview(v int64) *NodeUpsert {
|
|
u.Set(node.FieldTotalReview, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateTotalReview sets the "total_review" field to the value that was provided on create.
|
|
func (u *NodeUpsert) UpdateTotalReview() *NodeUpsert {
|
|
u.SetExcluded(node.FieldTotalReview)
|
|
return u
|
|
}
|
|
|
|
// AddTotalReview adds v to the "total_review" field.
|
|
func (u *NodeUpsert) AddTotalReview(v int64) *NodeUpsert {
|
|
u.Add(node.FieldTotalReview, v)
|
|
return u
|
|
}
|
|
|
|
// SetStatus sets the "status" field.
|
|
func (u *NodeUpsert) SetStatus(v schema.NodeStatus) *NodeUpsert {
|
|
u.Set(node.FieldStatus, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateStatus sets the "status" field to the value that was provided on create.
|
|
func (u *NodeUpsert) UpdateStatus() *NodeUpsert {
|
|
u.SetExcluded(node.FieldStatus)
|
|
return u
|
|
}
|
|
|
|
// SetStatusDetail sets the "status_detail" field.
|
|
func (u *NodeUpsert) SetStatusDetail(v string) *NodeUpsert {
|
|
u.Set(node.FieldStatusDetail, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateStatusDetail sets the "status_detail" field to the value that was provided on create.
|
|
func (u *NodeUpsert) UpdateStatusDetail() *NodeUpsert {
|
|
u.SetExcluded(node.FieldStatusDetail)
|
|
return u
|
|
}
|
|
|
|
// ClearStatusDetail clears the value of the "status_detail" field.
|
|
func (u *NodeUpsert) ClearStatusDetail() *NodeUpsert {
|
|
u.SetNull(node.FieldStatusDetail)
|
|
return u
|
|
}
|
|
|
|
// SetLastAlgoliaIndexTime sets the "last_algolia_index_time" field.
|
|
func (u *NodeUpsert) SetLastAlgoliaIndexTime(v time.Time) *NodeUpsert {
|
|
u.Set(node.FieldLastAlgoliaIndexTime, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateLastAlgoliaIndexTime sets the "last_algolia_index_time" field to the value that was provided on create.
|
|
func (u *NodeUpsert) UpdateLastAlgoliaIndexTime() *NodeUpsert {
|
|
u.SetExcluded(node.FieldLastAlgoliaIndexTime)
|
|
return u
|
|
}
|
|
|
|
// ClearLastAlgoliaIndexTime clears the value of the "last_algolia_index_time" field.
|
|
func (u *NodeUpsert) ClearLastAlgoliaIndexTime() *NodeUpsert {
|
|
u.SetNull(node.FieldLastAlgoliaIndexTime)
|
|
return u
|
|
}
|
|
|
|
// UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field.
|
|
// Using this option is equivalent to using:
|
|
//
|
|
// client.Node.Create().
|
|
// OnConflict(
|
|
// sql.ResolveWithNewValues(),
|
|
// sql.ResolveWith(func(u *sql.UpdateSet) {
|
|
// u.SetIgnore(node.FieldID)
|
|
// }),
|
|
// ).
|
|
// Exec(ctx)
|
|
func (u *NodeUpsertOne) UpdateNewValues() *NodeUpsertOne {
|
|
u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
|
|
u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) {
|
|
if _, exists := u.create.mutation.ID(); exists {
|
|
s.SetIgnore(node.FieldID)
|
|
}
|
|
if _, exists := u.create.mutation.CreateTime(); exists {
|
|
s.SetIgnore(node.FieldCreateTime)
|
|
}
|
|
}))
|
|
return u
|
|
}
|
|
|
|
// Ignore sets each column to itself in case of conflict.
|
|
// Using this option is equivalent to using:
|
|
//
|
|
// client.Node.Create().
|
|
// OnConflict(sql.ResolveWithIgnore()).
|
|
// Exec(ctx)
|
|
func (u *NodeUpsertOne) Ignore() *NodeUpsertOne {
|
|
u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore())
|
|
return u
|
|
}
|
|
|
|
// DoNothing configures the conflict_action to `DO NOTHING`.
|
|
// Supported only by SQLite and PostgreSQL.
|
|
func (u *NodeUpsertOne) DoNothing() *NodeUpsertOne {
|
|
u.create.conflict = append(u.create.conflict, sql.DoNothing())
|
|
return u
|
|
}
|
|
|
|
// Update allows overriding fields `UPDATE` values. See the NodeCreate.OnConflict
|
|
// documentation for more info.
|
|
func (u *NodeUpsertOne) Update(set func(*NodeUpsert)) *NodeUpsertOne {
|
|
u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
|
|
set(&NodeUpsert{UpdateSet: update})
|
|
}))
|
|
return u
|
|
}
|
|
|
|
// SetUpdateTime sets the "update_time" field.
|
|
func (u *NodeUpsertOne) SetUpdateTime(v time.Time) *NodeUpsertOne {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.SetUpdateTime(v)
|
|
})
|
|
}
|
|
|
|
// UpdateUpdateTime sets the "update_time" field to the value that was provided on create.
|
|
func (u *NodeUpsertOne) UpdateUpdateTime() *NodeUpsertOne {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.UpdateUpdateTime()
|
|
})
|
|
}
|
|
|
|
// SetNormalizedID sets the "normalized_id" field.
|
|
func (u *NodeUpsertOne) SetNormalizedID(v string) *NodeUpsertOne {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.SetNormalizedID(v)
|
|
})
|
|
}
|
|
|
|
// UpdateNormalizedID sets the "normalized_id" field to the value that was provided on create.
|
|
func (u *NodeUpsertOne) UpdateNormalizedID() *NodeUpsertOne {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.UpdateNormalizedID()
|
|
})
|
|
}
|
|
|
|
// SetPublisherID sets the "publisher_id" field.
|
|
func (u *NodeUpsertOne) SetPublisherID(v string) *NodeUpsertOne {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.SetPublisherID(v)
|
|
})
|
|
}
|
|
|
|
// UpdatePublisherID sets the "publisher_id" field to the value that was provided on create.
|
|
func (u *NodeUpsertOne) UpdatePublisherID() *NodeUpsertOne {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.UpdatePublisherID()
|
|
})
|
|
}
|
|
|
|
// SetName sets the "name" field.
|
|
func (u *NodeUpsertOne) SetName(v string) *NodeUpsertOne {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.SetName(v)
|
|
})
|
|
}
|
|
|
|
// UpdateName sets the "name" field to the value that was provided on create.
|
|
func (u *NodeUpsertOne) UpdateName() *NodeUpsertOne {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.UpdateName()
|
|
})
|
|
}
|
|
|
|
// SetDescription sets the "description" field.
|
|
func (u *NodeUpsertOne) SetDescription(v string) *NodeUpsertOne {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.SetDescription(v)
|
|
})
|
|
}
|
|
|
|
// UpdateDescription sets the "description" field to the value that was provided on create.
|
|
func (u *NodeUpsertOne) UpdateDescription() *NodeUpsertOne {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.UpdateDescription()
|
|
})
|
|
}
|
|
|
|
// ClearDescription clears the value of the "description" field.
|
|
func (u *NodeUpsertOne) ClearDescription() *NodeUpsertOne {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.ClearDescription()
|
|
})
|
|
}
|
|
|
|
// SetCategory sets the "category" field.
|
|
func (u *NodeUpsertOne) SetCategory(v string) *NodeUpsertOne {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.SetCategory(v)
|
|
})
|
|
}
|
|
|
|
// UpdateCategory sets the "category" field to the value that was provided on create.
|
|
func (u *NodeUpsertOne) UpdateCategory() *NodeUpsertOne {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.UpdateCategory()
|
|
})
|
|
}
|
|
|
|
// ClearCategory clears the value of the "category" field.
|
|
func (u *NodeUpsertOne) ClearCategory() *NodeUpsertOne {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.ClearCategory()
|
|
})
|
|
}
|
|
|
|
// SetAuthor sets the "author" field.
|
|
func (u *NodeUpsertOne) SetAuthor(v string) *NodeUpsertOne {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.SetAuthor(v)
|
|
})
|
|
}
|
|
|
|
// UpdateAuthor sets the "author" field to the value that was provided on create.
|
|
func (u *NodeUpsertOne) UpdateAuthor() *NodeUpsertOne {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.UpdateAuthor()
|
|
})
|
|
}
|
|
|
|
// ClearAuthor clears the value of the "author" field.
|
|
func (u *NodeUpsertOne) ClearAuthor() *NodeUpsertOne {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.ClearAuthor()
|
|
})
|
|
}
|
|
|
|
// SetLicense sets the "license" field.
|
|
func (u *NodeUpsertOne) SetLicense(v string) *NodeUpsertOne {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.SetLicense(v)
|
|
})
|
|
}
|
|
|
|
// UpdateLicense sets the "license" field to the value that was provided on create.
|
|
func (u *NodeUpsertOne) UpdateLicense() *NodeUpsertOne {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.UpdateLicense()
|
|
})
|
|
}
|
|
|
|
// SetRepositoryURL sets the "repository_url" field.
|
|
func (u *NodeUpsertOne) SetRepositoryURL(v string) *NodeUpsertOne {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.SetRepositoryURL(v)
|
|
})
|
|
}
|
|
|
|
// UpdateRepositoryURL sets the "repository_url" field to the value that was provided on create.
|
|
func (u *NodeUpsertOne) UpdateRepositoryURL() *NodeUpsertOne {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.UpdateRepositoryURL()
|
|
})
|
|
}
|
|
|
|
// SetIconURL sets the "icon_url" field.
|
|
func (u *NodeUpsertOne) SetIconURL(v string) *NodeUpsertOne {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.SetIconURL(v)
|
|
})
|
|
}
|
|
|
|
// UpdateIconURL sets the "icon_url" field to the value that was provided on create.
|
|
func (u *NodeUpsertOne) UpdateIconURL() *NodeUpsertOne {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.UpdateIconURL()
|
|
})
|
|
}
|
|
|
|
// ClearIconURL clears the value of the "icon_url" field.
|
|
func (u *NodeUpsertOne) ClearIconURL() *NodeUpsertOne {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.ClearIconURL()
|
|
})
|
|
}
|
|
|
|
// SetTags sets the "tags" field.
|
|
func (u *NodeUpsertOne) SetTags(v []string) *NodeUpsertOne {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.SetTags(v)
|
|
})
|
|
}
|
|
|
|
// UpdateTags sets the "tags" field to the value that was provided on create.
|
|
func (u *NodeUpsertOne) UpdateTags() *NodeUpsertOne {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.UpdateTags()
|
|
})
|
|
}
|
|
|
|
// SetTotalInstall sets the "total_install" field.
|
|
func (u *NodeUpsertOne) SetTotalInstall(v int64) *NodeUpsertOne {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.SetTotalInstall(v)
|
|
})
|
|
}
|
|
|
|
// AddTotalInstall adds v to the "total_install" field.
|
|
func (u *NodeUpsertOne) AddTotalInstall(v int64) *NodeUpsertOne {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.AddTotalInstall(v)
|
|
})
|
|
}
|
|
|
|
// UpdateTotalInstall sets the "total_install" field to the value that was provided on create.
|
|
func (u *NodeUpsertOne) UpdateTotalInstall() *NodeUpsertOne {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.UpdateTotalInstall()
|
|
})
|
|
}
|
|
|
|
// SetTotalStar sets the "total_star" field.
|
|
func (u *NodeUpsertOne) SetTotalStar(v int64) *NodeUpsertOne {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.SetTotalStar(v)
|
|
})
|
|
}
|
|
|
|
// AddTotalStar adds v to the "total_star" field.
|
|
func (u *NodeUpsertOne) AddTotalStar(v int64) *NodeUpsertOne {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.AddTotalStar(v)
|
|
})
|
|
}
|
|
|
|
// UpdateTotalStar sets the "total_star" field to the value that was provided on create.
|
|
func (u *NodeUpsertOne) UpdateTotalStar() *NodeUpsertOne {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.UpdateTotalStar()
|
|
})
|
|
}
|
|
|
|
// SetTotalReview sets the "total_review" field.
|
|
func (u *NodeUpsertOne) SetTotalReview(v int64) *NodeUpsertOne {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.SetTotalReview(v)
|
|
})
|
|
}
|
|
|
|
// AddTotalReview adds v to the "total_review" field.
|
|
func (u *NodeUpsertOne) AddTotalReview(v int64) *NodeUpsertOne {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.AddTotalReview(v)
|
|
})
|
|
}
|
|
|
|
// UpdateTotalReview sets the "total_review" field to the value that was provided on create.
|
|
func (u *NodeUpsertOne) UpdateTotalReview() *NodeUpsertOne {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.UpdateTotalReview()
|
|
})
|
|
}
|
|
|
|
// SetStatus sets the "status" field.
|
|
func (u *NodeUpsertOne) SetStatus(v schema.NodeStatus) *NodeUpsertOne {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.SetStatus(v)
|
|
})
|
|
}
|
|
|
|
// UpdateStatus sets the "status" field to the value that was provided on create.
|
|
func (u *NodeUpsertOne) UpdateStatus() *NodeUpsertOne {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.UpdateStatus()
|
|
})
|
|
}
|
|
|
|
// SetStatusDetail sets the "status_detail" field.
|
|
func (u *NodeUpsertOne) SetStatusDetail(v string) *NodeUpsertOne {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.SetStatusDetail(v)
|
|
})
|
|
}
|
|
|
|
// UpdateStatusDetail sets the "status_detail" field to the value that was provided on create.
|
|
func (u *NodeUpsertOne) UpdateStatusDetail() *NodeUpsertOne {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.UpdateStatusDetail()
|
|
})
|
|
}
|
|
|
|
// ClearStatusDetail clears the value of the "status_detail" field.
|
|
func (u *NodeUpsertOne) ClearStatusDetail() *NodeUpsertOne {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.ClearStatusDetail()
|
|
})
|
|
}
|
|
|
|
// SetLastAlgoliaIndexTime sets the "last_algolia_index_time" field.
|
|
func (u *NodeUpsertOne) SetLastAlgoliaIndexTime(v time.Time) *NodeUpsertOne {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.SetLastAlgoliaIndexTime(v)
|
|
})
|
|
}
|
|
|
|
// UpdateLastAlgoliaIndexTime sets the "last_algolia_index_time" field to the value that was provided on create.
|
|
func (u *NodeUpsertOne) UpdateLastAlgoliaIndexTime() *NodeUpsertOne {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.UpdateLastAlgoliaIndexTime()
|
|
})
|
|
}
|
|
|
|
// ClearLastAlgoliaIndexTime clears the value of the "last_algolia_index_time" field.
|
|
func (u *NodeUpsertOne) ClearLastAlgoliaIndexTime() *NodeUpsertOne {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.ClearLastAlgoliaIndexTime()
|
|
})
|
|
}
|
|
|
|
// Exec executes the query.
|
|
func (u *NodeUpsertOne) Exec(ctx context.Context) error {
|
|
if len(u.create.conflict) == 0 {
|
|
return errors.New("ent: missing options for NodeCreate.OnConflict")
|
|
}
|
|
return u.create.Exec(ctx)
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (u *NodeUpsertOne) ExecX(ctx context.Context) {
|
|
if err := u.create.Exec(ctx); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
// Exec executes the UPSERT query and returns the inserted/updated ID.
|
|
func (u *NodeUpsertOne) ID(ctx context.Context) (id string, err error) {
|
|
if u.create.driver.Dialect() == dialect.MySQL {
|
|
// In case of "ON CONFLICT", there is no way to get back non-numeric ID
|
|
// fields from the database since MySQL does not support the RETURNING clause.
|
|
return id, errors.New("ent: NodeUpsertOne.ID is not supported by MySQL driver. Use NodeUpsertOne.Exec instead")
|
|
}
|
|
node, err := u.create.Save(ctx)
|
|
if err != nil {
|
|
return id, err
|
|
}
|
|
return node.ID, nil
|
|
}
|
|
|
|
// IDX is like ID, but panics if an error occurs.
|
|
func (u *NodeUpsertOne) IDX(ctx context.Context) string {
|
|
id, err := u.ID(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return id
|
|
}
|
|
|
|
// NodeCreateBulk is the builder for creating many Node entities in bulk.
|
|
type NodeCreateBulk struct {
|
|
config
|
|
err error
|
|
builders []*NodeCreate
|
|
conflict []sql.ConflictOption
|
|
}
|
|
|
|
// Save creates the Node entities in the database.
|
|
func (ncb *NodeCreateBulk) Save(ctx context.Context) ([]*Node, error) {
|
|
if ncb.err != nil {
|
|
return nil, ncb.err
|
|
}
|
|
specs := make([]*sqlgraph.CreateSpec, len(ncb.builders))
|
|
nodes := make([]*Node, len(ncb.builders))
|
|
mutators := make([]Mutator, len(ncb.builders))
|
|
for i := range ncb.builders {
|
|
func(i int, root context.Context) {
|
|
builder := ncb.builders[i]
|
|
builder.defaults()
|
|
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
|
mutation, ok := m.(*NodeMutation)
|
|
if !ok {
|
|
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
|
}
|
|
if err := builder.check(); err != nil {
|
|
return nil, err
|
|
}
|
|
builder.mutation = mutation
|
|
var err error
|
|
nodes[i], specs[i] = builder.createSpec()
|
|
if i < len(mutators)-1 {
|
|
_, err = mutators[i+1].Mutate(root, ncb.builders[i+1].mutation)
|
|
} else {
|
|
spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
|
|
spec.OnConflict = ncb.conflict
|
|
// Invoke the actual operation on the latest mutation in the chain.
|
|
if err = sqlgraph.BatchCreate(ctx, ncb.driver, spec); err != nil {
|
|
if sqlgraph.IsConstraintError(err) {
|
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
|
}
|
|
}
|
|
}
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
mutation.id = &nodes[i].ID
|
|
mutation.done = true
|
|
return nodes[i], nil
|
|
})
|
|
for i := len(builder.hooks) - 1; i >= 0; i-- {
|
|
mut = builder.hooks[i](mut)
|
|
}
|
|
mutators[i] = mut
|
|
}(i, ctx)
|
|
}
|
|
if len(mutators) > 0 {
|
|
if _, err := mutators[0].Mutate(ctx, ncb.builders[0].mutation); err != nil {
|
|
return nil, err
|
|
}
|
|
}
|
|
return nodes, nil
|
|
}
|
|
|
|
// SaveX is like Save, but panics if an error occurs.
|
|
func (ncb *NodeCreateBulk) SaveX(ctx context.Context) []*Node {
|
|
v, err := ncb.Save(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return v
|
|
}
|
|
|
|
// Exec executes the query.
|
|
func (ncb *NodeCreateBulk) Exec(ctx context.Context) error {
|
|
_, err := ncb.Save(ctx)
|
|
return err
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (ncb *NodeCreateBulk) ExecX(ctx context.Context) {
|
|
if err := ncb.Exec(ctx); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
|
|
// of the `INSERT` statement. For example:
|
|
//
|
|
// client.Node.CreateBulk(builders...).
|
|
// OnConflict(
|
|
// // Update the row with the new values
|
|
// // the was proposed for insertion.
|
|
// sql.ResolveWithNewValues(),
|
|
// ).
|
|
// // Override some of the fields with custom
|
|
// // update values.
|
|
// Update(func(u *ent.NodeUpsert) {
|
|
// SetCreateTime(v+v).
|
|
// }).
|
|
// Exec(ctx)
|
|
func (ncb *NodeCreateBulk) OnConflict(opts ...sql.ConflictOption) *NodeUpsertBulk {
|
|
ncb.conflict = opts
|
|
return &NodeUpsertBulk{
|
|
create: ncb,
|
|
}
|
|
}
|
|
|
|
// OnConflictColumns calls `OnConflict` and configures the columns
|
|
// as conflict target. Using this option is equivalent to using:
|
|
//
|
|
// client.Node.Create().
|
|
// OnConflict(sql.ConflictColumns(columns...)).
|
|
// Exec(ctx)
|
|
func (ncb *NodeCreateBulk) OnConflictColumns(columns ...string) *NodeUpsertBulk {
|
|
ncb.conflict = append(ncb.conflict, sql.ConflictColumns(columns...))
|
|
return &NodeUpsertBulk{
|
|
create: ncb,
|
|
}
|
|
}
|
|
|
|
// NodeUpsertBulk is the builder for "upsert"-ing
|
|
// a bulk of Node nodes.
|
|
type NodeUpsertBulk struct {
|
|
create *NodeCreateBulk
|
|
}
|
|
|
|
// UpdateNewValues updates the mutable fields using the new values that
|
|
// were set on create. Using this option is equivalent to using:
|
|
//
|
|
// client.Node.Create().
|
|
// OnConflict(
|
|
// sql.ResolveWithNewValues(),
|
|
// sql.ResolveWith(func(u *sql.UpdateSet) {
|
|
// u.SetIgnore(node.FieldID)
|
|
// }),
|
|
// ).
|
|
// Exec(ctx)
|
|
func (u *NodeUpsertBulk) UpdateNewValues() *NodeUpsertBulk {
|
|
u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
|
|
u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) {
|
|
for _, b := range u.create.builders {
|
|
if _, exists := b.mutation.ID(); exists {
|
|
s.SetIgnore(node.FieldID)
|
|
}
|
|
if _, exists := b.mutation.CreateTime(); exists {
|
|
s.SetIgnore(node.FieldCreateTime)
|
|
}
|
|
}
|
|
}))
|
|
return u
|
|
}
|
|
|
|
// Ignore sets each column to itself in case of conflict.
|
|
// Using this option is equivalent to using:
|
|
//
|
|
// client.Node.Create().
|
|
// OnConflict(sql.ResolveWithIgnore()).
|
|
// Exec(ctx)
|
|
func (u *NodeUpsertBulk) Ignore() *NodeUpsertBulk {
|
|
u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore())
|
|
return u
|
|
}
|
|
|
|
// DoNothing configures the conflict_action to `DO NOTHING`.
|
|
// Supported only by SQLite and PostgreSQL.
|
|
func (u *NodeUpsertBulk) DoNothing() *NodeUpsertBulk {
|
|
u.create.conflict = append(u.create.conflict, sql.DoNothing())
|
|
return u
|
|
}
|
|
|
|
// Update allows overriding fields `UPDATE` values. See the NodeCreateBulk.OnConflict
|
|
// documentation for more info.
|
|
func (u *NodeUpsertBulk) Update(set func(*NodeUpsert)) *NodeUpsertBulk {
|
|
u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
|
|
set(&NodeUpsert{UpdateSet: update})
|
|
}))
|
|
return u
|
|
}
|
|
|
|
// SetUpdateTime sets the "update_time" field.
|
|
func (u *NodeUpsertBulk) SetUpdateTime(v time.Time) *NodeUpsertBulk {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.SetUpdateTime(v)
|
|
})
|
|
}
|
|
|
|
// UpdateUpdateTime sets the "update_time" field to the value that was provided on create.
|
|
func (u *NodeUpsertBulk) UpdateUpdateTime() *NodeUpsertBulk {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.UpdateUpdateTime()
|
|
})
|
|
}
|
|
|
|
// SetNormalizedID sets the "normalized_id" field.
|
|
func (u *NodeUpsertBulk) SetNormalizedID(v string) *NodeUpsertBulk {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.SetNormalizedID(v)
|
|
})
|
|
}
|
|
|
|
// UpdateNormalizedID sets the "normalized_id" field to the value that was provided on create.
|
|
func (u *NodeUpsertBulk) UpdateNormalizedID() *NodeUpsertBulk {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.UpdateNormalizedID()
|
|
})
|
|
}
|
|
|
|
// SetPublisherID sets the "publisher_id" field.
|
|
func (u *NodeUpsertBulk) SetPublisherID(v string) *NodeUpsertBulk {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.SetPublisherID(v)
|
|
})
|
|
}
|
|
|
|
// UpdatePublisherID sets the "publisher_id" field to the value that was provided on create.
|
|
func (u *NodeUpsertBulk) UpdatePublisherID() *NodeUpsertBulk {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.UpdatePublisherID()
|
|
})
|
|
}
|
|
|
|
// SetName sets the "name" field.
|
|
func (u *NodeUpsertBulk) SetName(v string) *NodeUpsertBulk {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.SetName(v)
|
|
})
|
|
}
|
|
|
|
// UpdateName sets the "name" field to the value that was provided on create.
|
|
func (u *NodeUpsertBulk) UpdateName() *NodeUpsertBulk {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.UpdateName()
|
|
})
|
|
}
|
|
|
|
// SetDescription sets the "description" field.
|
|
func (u *NodeUpsertBulk) SetDescription(v string) *NodeUpsertBulk {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.SetDescription(v)
|
|
})
|
|
}
|
|
|
|
// UpdateDescription sets the "description" field to the value that was provided on create.
|
|
func (u *NodeUpsertBulk) UpdateDescription() *NodeUpsertBulk {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.UpdateDescription()
|
|
})
|
|
}
|
|
|
|
// ClearDescription clears the value of the "description" field.
|
|
func (u *NodeUpsertBulk) ClearDescription() *NodeUpsertBulk {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.ClearDescription()
|
|
})
|
|
}
|
|
|
|
// SetCategory sets the "category" field.
|
|
func (u *NodeUpsertBulk) SetCategory(v string) *NodeUpsertBulk {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.SetCategory(v)
|
|
})
|
|
}
|
|
|
|
// UpdateCategory sets the "category" field to the value that was provided on create.
|
|
func (u *NodeUpsertBulk) UpdateCategory() *NodeUpsertBulk {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.UpdateCategory()
|
|
})
|
|
}
|
|
|
|
// ClearCategory clears the value of the "category" field.
|
|
func (u *NodeUpsertBulk) ClearCategory() *NodeUpsertBulk {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.ClearCategory()
|
|
})
|
|
}
|
|
|
|
// SetAuthor sets the "author" field.
|
|
func (u *NodeUpsertBulk) SetAuthor(v string) *NodeUpsertBulk {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.SetAuthor(v)
|
|
})
|
|
}
|
|
|
|
// UpdateAuthor sets the "author" field to the value that was provided on create.
|
|
func (u *NodeUpsertBulk) UpdateAuthor() *NodeUpsertBulk {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.UpdateAuthor()
|
|
})
|
|
}
|
|
|
|
// ClearAuthor clears the value of the "author" field.
|
|
func (u *NodeUpsertBulk) ClearAuthor() *NodeUpsertBulk {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.ClearAuthor()
|
|
})
|
|
}
|
|
|
|
// SetLicense sets the "license" field.
|
|
func (u *NodeUpsertBulk) SetLicense(v string) *NodeUpsertBulk {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.SetLicense(v)
|
|
})
|
|
}
|
|
|
|
// UpdateLicense sets the "license" field to the value that was provided on create.
|
|
func (u *NodeUpsertBulk) UpdateLicense() *NodeUpsertBulk {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.UpdateLicense()
|
|
})
|
|
}
|
|
|
|
// SetRepositoryURL sets the "repository_url" field.
|
|
func (u *NodeUpsertBulk) SetRepositoryURL(v string) *NodeUpsertBulk {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.SetRepositoryURL(v)
|
|
})
|
|
}
|
|
|
|
// UpdateRepositoryURL sets the "repository_url" field to the value that was provided on create.
|
|
func (u *NodeUpsertBulk) UpdateRepositoryURL() *NodeUpsertBulk {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.UpdateRepositoryURL()
|
|
})
|
|
}
|
|
|
|
// SetIconURL sets the "icon_url" field.
|
|
func (u *NodeUpsertBulk) SetIconURL(v string) *NodeUpsertBulk {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.SetIconURL(v)
|
|
})
|
|
}
|
|
|
|
// UpdateIconURL sets the "icon_url" field to the value that was provided on create.
|
|
func (u *NodeUpsertBulk) UpdateIconURL() *NodeUpsertBulk {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.UpdateIconURL()
|
|
})
|
|
}
|
|
|
|
// ClearIconURL clears the value of the "icon_url" field.
|
|
func (u *NodeUpsertBulk) ClearIconURL() *NodeUpsertBulk {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.ClearIconURL()
|
|
})
|
|
}
|
|
|
|
// SetTags sets the "tags" field.
|
|
func (u *NodeUpsertBulk) SetTags(v []string) *NodeUpsertBulk {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.SetTags(v)
|
|
})
|
|
}
|
|
|
|
// UpdateTags sets the "tags" field to the value that was provided on create.
|
|
func (u *NodeUpsertBulk) UpdateTags() *NodeUpsertBulk {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.UpdateTags()
|
|
})
|
|
}
|
|
|
|
// SetTotalInstall sets the "total_install" field.
|
|
func (u *NodeUpsertBulk) SetTotalInstall(v int64) *NodeUpsertBulk {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.SetTotalInstall(v)
|
|
})
|
|
}
|
|
|
|
// AddTotalInstall adds v to the "total_install" field.
|
|
func (u *NodeUpsertBulk) AddTotalInstall(v int64) *NodeUpsertBulk {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.AddTotalInstall(v)
|
|
})
|
|
}
|
|
|
|
// UpdateTotalInstall sets the "total_install" field to the value that was provided on create.
|
|
func (u *NodeUpsertBulk) UpdateTotalInstall() *NodeUpsertBulk {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.UpdateTotalInstall()
|
|
})
|
|
}
|
|
|
|
// SetTotalStar sets the "total_star" field.
|
|
func (u *NodeUpsertBulk) SetTotalStar(v int64) *NodeUpsertBulk {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.SetTotalStar(v)
|
|
})
|
|
}
|
|
|
|
// AddTotalStar adds v to the "total_star" field.
|
|
func (u *NodeUpsertBulk) AddTotalStar(v int64) *NodeUpsertBulk {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.AddTotalStar(v)
|
|
})
|
|
}
|
|
|
|
// UpdateTotalStar sets the "total_star" field to the value that was provided on create.
|
|
func (u *NodeUpsertBulk) UpdateTotalStar() *NodeUpsertBulk {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.UpdateTotalStar()
|
|
})
|
|
}
|
|
|
|
// SetTotalReview sets the "total_review" field.
|
|
func (u *NodeUpsertBulk) SetTotalReview(v int64) *NodeUpsertBulk {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.SetTotalReview(v)
|
|
})
|
|
}
|
|
|
|
// AddTotalReview adds v to the "total_review" field.
|
|
func (u *NodeUpsertBulk) AddTotalReview(v int64) *NodeUpsertBulk {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.AddTotalReview(v)
|
|
})
|
|
}
|
|
|
|
// UpdateTotalReview sets the "total_review" field to the value that was provided on create.
|
|
func (u *NodeUpsertBulk) UpdateTotalReview() *NodeUpsertBulk {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.UpdateTotalReview()
|
|
})
|
|
}
|
|
|
|
// SetStatus sets the "status" field.
|
|
func (u *NodeUpsertBulk) SetStatus(v schema.NodeStatus) *NodeUpsertBulk {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.SetStatus(v)
|
|
})
|
|
}
|
|
|
|
// UpdateStatus sets the "status" field to the value that was provided on create.
|
|
func (u *NodeUpsertBulk) UpdateStatus() *NodeUpsertBulk {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.UpdateStatus()
|
|
})
|
|
}
|
|
|
|
// SetStatusDetail sets the "status_detail" field.
|
|
func (u *NodeUpsertBulk) SetStatusDetail(v string) *NodeUpsertBulk {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.SetStatusDetail(v)
|
|
})
|
|
}
|
|
|
|
// UpdateStatusDetail sets the "status_detail" field to the value that was provided on create.
|
|
func (u *NodeUpsertBulk) UpdateStatusDetail() *NodeUpsertBulk {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.UpdateStatusDetail()
|
|
})
|
|
}
|
|
|
|
// ClearStatusDetail clears the value of the "status_detail" field.
|
|
func (u *NodeUpsertBulk) ClearStatusDetail() *NodeUpsertBulk {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.ClearStatusDetail()
|
|
})
|
|
}
|
|
|
|
// SetLastAlgoliaIndexTime sets the "last_algolia_index_time" field.
|
|
func (u *NodeUpsertBulk) SetLastAlgoliaIndexTime(v time.Time) *NodeUpsertBulk {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.SetLastAlgoliaIndexTime(v)
|
|
})
|
|
}
|
|
|
|
// UpdateLastAlgoliaIndexTime sets the "last_algolia_index_time" field to the value that was provided on create.
|
|
func (u *NodeUpsertBulk) UpdateLastAlgoliaIndexTime() *NodeUpsertBulk {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.UpdateLastAlgoliaIndexTime()
|
|
})
|
|
}
|
|
|
|
// ClearLastAlgoliaIndexTime clears the value of the "last_algolia_index_time" field.
|
|
func (u *NodeUpsertBulk) ClearLastAlgoliaIndexTime() *NodeUpsertBulk {
|
|
return u.Update(func(s *NodeUpsert) {
|
|
s.ClearLastAlgoliaIndexTime()
|
|
})
|
|
}
|
|
|
|
// Exec executes the query.
|
|
func (u *NodeUpsertBulk) Exec(ctx context.Context) error {
|
|
if u.create.err != nil {
|
|
return u.create.err
|
|
}
|
|
for i, b := range u.create.builders {
|
|
if len(b.conflict) != 0 {
|
|
return fmt.Errorf("ent: OnConflict was set for builder %d. Set it on the NodeCreateBulk instead", i)
|
|
}
|
|
}
|
|
if len(u.create.conflict) == 0 {
|
|
return errors.New("ent: missing options for NodeCreateBulk.OnConflict")
|
|
}
|
|
return u.create.Exec(ctx)
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (u *NodeUpsertBulk) ExecX(ctx context.Context) {
|
|
if err := u.create.Exec(ctx); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|