1746 lines
56 KiB
Go
1746 lines
56 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|||
|
|
|
||
|
|
package ent
|
||
|
|
|
||
|
|
import (
|
||
|
|
"context"
|
||
|
|
"errors"
|
||
|
|
"fmt"
|
||
|
|
"time"
|
||
|
|
|
||
|
|
"entgo.io/ent/dialect/sql"
|
||
|
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||
|
|
"entgo.io/ent/schema/field"
|
||
|
|
"github.com/Wei-Shaw/sub2api/ent/batchimageitem"
|
||
|
|
)
|
||
|
|
|
||
|
|
// BatchImageItemCreate is the builder for creating a BatchImageItem entity.
|
||
|
|
type BatchImageItemCreate struct {
|
||
|
|
config
|
||
|
|
mutation *BatchImageItemMutation
|
||
|
|
hooks []Hook
|
||
|
|
conflict []sql.ConflictOption
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetJobID sets the "job_id" field.
|
||
|
|
func (_c *BatchImageItemCreate) SetJobID(v string) *BatchImageItemCreate {
|
||
|
|
_c.mutation.SetJobID(v)
|
||
|
|
return _c
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetCustomID sets the "custom_id" field.
|
||
|
|
func (_c *BatchImageItemCreate) SetCustomID(v string) *BatchImageItemCreate {
|
||
|
|
_c.mutation.SetCustomID(v)
|
||
|
|
return _c
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetStatus sets the "status" field.
|
||
|
|
func (_c *BatchImageItemCreate) SetStatus(v string) *BatchImageItemCreate {
|
||
|
|
_c.mutation.SetStatus(v)
|
||
|
|
return _c
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetRequestHash sets the "request_hash" field.
|
||
|
|
func (_c *BatchImageItemCreate) SetRequestHash(v string) *BatchImageItemCreate {
|
||
|
|
_c.mutation.SetRequestHash(v)
|
||
|
|
return _c
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetNillableRequestHash sets the "request_hash" field if the given value is not nil.
|
||
|
|
func (_c *BatchImageItemCreate) SetNillableRequestHash(v *string) *BatchImageItemCreate {
|
||
|
|
if v != nil {
|
||
|
|
_c.SetRequestHash(*v)
|
||
|
|
}
|
||
|
|
return _c
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetPromptPreview sets the "prompt_preview" field.
|
||
|
|
func (_c *BatchImageItemCreate) SetPromptPreview(v string) *BatchImageItemCreate {
|
||
|
|
_c.mutation.SetPromptPreview(v)
|
||
|
|
return _c
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetNillablePromptPreview sets the "prompt_preview" field if the given value is not nil.
|
||
|
|
func (_c *BatchImageItemCreate) SetNillablePromptPreview(v *string) *BatchImageItemCreate {
|
||
|
|
if v != nil {
|
||
|
|
_c.SetPromptPreview(*v)
|
||
|
|
}
|
||
|
|
return _c
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetProviderSourceObject sets the "provider_source_object" field.
|
||
|
|
func (_c *BatchImageItemCreate) SetProviderSourceObject(v string) *BatchImageItemCreate {
|
||
|
|
_c.mutation.SetProviderSourceObject(v)
|
||
|
|
return _c
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetNillableProviderSourceObject sets the "provider_source_object" field if the given value is not nil.
|
||
|
|
func (_c *BatchImageItemCreate) SetNillableProviderSourceObject(v *string) *BatchImageItemCreate {
|
||
|
|
if v != nil {
|
||
|
|
_c.SetProviderSourceObject(*v)
|
||
|
|
}
|
||
|
|
return _c
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetSourceLineNumber sets the "source_line_number" field.
|
||
|
|
func (_c *BatchImageItemCreate) SetSourceLineNumber(v int) *BatchImageItemCreate {
|
||
|
|
_c.mutation.SetSourceLineNumber(v)
|
||
|
|
return _c
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetNillableSourceLineNumber sets the "source_line_number" field if the given value is not nil.
|
||
|
|
func (_c *BatchImageItemCreate) SetNillableSourceLineNumber(v *int) *BatchImageItemCreate {
|
||
|
|
if v != nil {
|
||
|
|
_c.SetSourceLineNumber(*v)
|
||
|
|
}
|
||
|
|
return _c
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetSourceByteOffset sets the "source_byte_offset" field.
|
||
|
|
func (_c *BatchImageItemCreate) SetSourceByteOffset(v int64) *BatchImageItemCreate {
|
||
|
|
_c.mutation.SetSourceByteOffset(v)
|
||
|
|
return _c
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetNillableSourceByteOffset sets the "source_byte_offset" field if the given value is not nil.
|
||
|
|
func (_c *BatchImageItemCreate) SetNillableSourceByteOffset(v *int64) *BatchImageItemCreate {
|
||
|
|
if v != nil {
|
||
|
|
_c.SetSourceByteOffset(*v)
|
||
|
|
}
|
||
|
|
return _c
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetSourceByteLength sets the "source_byte_length" field.
|
||
|
|
func (_c *BatchImageItemCreate) SetSourceByteLength(v int64) *BatchImageItemCreate {
|
||
|
|
_c.mutation.SetSourceByteLength(v)
|
||
|
|
return _c
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetNillableSourceByteLength sets the "source_byte_length" field if the given value is not nil.
|
||
|
|
func (_c *BatchImageItemCreate) SetNillableSourceByteLength(v *int64) *BatchImageItemCreate {
|
||
|
|
if v != nil {
|
||
|
|
_c.SetSourceByteLength(*v)
|
||
|
|
}
|
||
|
|
return _c
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetMimeType sets the "mime_type" field.
|
||
|
|
func (_c *BatchImageItemCreate) SetMimeType(v string) *BatchImageItemCreate {
|
||
|
|
_c.mutation.SetMimeType(v)
|
||
|
|
return _c
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetNillableMimeType sets the "mime_type" field if the given value is not nil.
|
||
|
|
func (_c *BatchImageItemCreate) SetNillableMimeType(v *string) *BatchImageItemCreate {
|
||
|
|
if v != nil {
|
||
|
|
_c.SetMimeType(*v)
|
||
|
|
}
|
||
|
|
return _c
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetFileExtension sets the "file_extension" field.
|
||
|
|
func (_c *BatchImageItemCreate) SetFileExtension(v string) *BatchImageItemCreate {
|
||
|
|
_c.mutation.SetFileExtension(v)
|
||
|
|
return _c
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetNillableFileExtension sets the "file_extension" field if the given value is not nil.
|
||
|
|
func (_c *BatchImageItemCreate) SetNillableFileExtension(v *string) *BatchImageItemCreate {
|
||
|
|
if v != nil {
|
||
|
|
_c.SetFileExtension(*v)
|
||
|
|
}
|
||
|
|
return _c
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetImageCount sets the "image_count" field.
|
||
|
|
func (_c *BatchImageItemCreate) SetImageCount(v int) *BatchImageItemCreate {
|
||
|
|
_c.mutation.SetImageCount(v)
|
||
|
|
return _c
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetNillableImageCount sets the "image_count" field if the given value is not nil.
|
||
|
|
func (_c *BatchImageItemCreate) SetNillableImageCount(v *int) *BatchImageItemCreate {
|
||
|
|
if v != nil {
|
||
|
|
_c.SetImageCount(*v)
|
||
|
|
}
|
||
|
|
return _c
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetErrorCode sets the "error_code" field.
|
||
|
|
func (_c *BatchImageItemCreate) SetErrorCode(v string) *BatchImageItemCreate {
|
||
|
|
_c.mutation.SetErrorCode(v)
|
||
|
|
return _c
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetNillableErrorCode sets the "error_code" field if the given value is not nil.
|
||
|
|
func (_c *BatchImageItemCreate) SetNillableErrorCode(v *string) *BatchImageItemCreate {
|
||
|
|
if v != nil {
|
||
|
|
_c.SetErrorCode(*v)
|
||
|
|
}
|
||
|
|
return _c
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetErrorMessage sets the "error_message" field.
|
||
|
|
func (_c *BatchImageItemCreate) SetErrorMessage(v string) *BatchImageItemCreate {
|
||
|
|
_c.mutation.SetErrorMessage(v)
|
||
|
|
return _c
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetNillableErrorMessage sets the "error_message" field if the given value is not nil.
|
||
|
|
func (_c *BatchImageItemCreate) SetNillableErrorMessage(v *string) *BatchImageItemCreate {
|
||
|
|
if v != nil {
|
||
|
|
_c.SetErrorMessage(*v)
|
||
|
|
}
|
||
|
|
return _c
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetBilledAmount sets the "billed_amount" field.
|
||
|
|
func (_c *BatchImageItemCreate) SetBilledAmount(v float64) *BatchImageItemCreate {
|
||
|
|
_c.mutation.SetBilledAmount(v)
|
||
|
|
return _c
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetNillableBilledAmount sets the "billed_amount" field if the given value is not nil.
|
||
|
|
func (_c *BatchImageItemCreate) SetNillableBilledAmount(v *float64) *BatchImageItemCreate {
|
||
|
|
if v != nil {
|
||
|
|
_c.SetBilledAmount(*v)
|
||
|
|
}
|
||
|
|
return _c
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetCreatedAt sets the "created_at" field.
|
||
|
|
func (_c *BatchImageItemCreate) SetCreatedAt(v time.Time) *BatchImageItemCreate {
|
||
|
|
_c.mutation.SetCreatedAt(v)
|
||
|
|
return _c
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
|
||
|
|
func (_c *BatchImageItemCreate) SetNillableCreatedAt(v *time.Time) *BatchImageItemCreate {
|
||
|
|
if v != nil {
|
||
|
|
_c.SetCreatedAt(*v)
|
||
|
|
}
|
||
|
|
return _c
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetIndexedAt sets the "indexed_at" field.
|
||
|
|
func (_c *BatchImageItemCreate) SetIndexedAt(v time.Time) *BatchImageItemCreate {
|
||
|
|
_c.mutation.SetIndexedAt(v)
|
||
|
|
return _c
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetNillableIndexedAt sets the "indexed_at" field if the given value is not nil.
|
||
|
|
func (_c *BatchImageItemCreate) SetNillableIndexedAt(v *time.Time) *BatchImageItemCreate {
|
||
|
|
if v != nil {
|
||
|
|
_c.SetIndexedAt(*v)
|
||
|
|
}
|
||
|
|
return _c
|
||
|
|
}
|
||
|
|
|
||
|
|
// Mutation returns the BatchImageItemMutation object of the builder.
|
||
|
|
func (_c *BatchImageItemCreate) Mutation() *BatchImageItemMutation {
|
||
|
|
return _c.mutation
|
||
|
|
}
|
||
|
|
|
||
|
|
// Save creates the BatchImageItem in the database.
|
||
|
|
func (_c *BatchImageItemCreate) Save(ctx context.Context) (*BatchImageItem, error) {
|
||
|
|
_c.defaults()
|
||
|
|
return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
|
||
|
|
}
|
||
|
|
|
||
|
|
// SaveX calls Save and panics if Save returns an error.
|
||
|
|
func (_c *BatchImageItemCreate) SaveX(ctx context.Context) *BatchImageItem {
|
||
|
|
v, err := _c.Save(ctx)
|
||
|
|
if err != nil {
|
||
|
|
panic(err)
|
||
|
|
}
|
||
|
|
return v
|
||
|
|
}
|
||
|
|
|
||
|
|
// Exec executes the query.
|
||
|
|
func (_c *BatchImageItemCreate) Exec(ctx context.Context) error {
|
||
|
|
_, err := _c.Save(ctx)
|
||
|
|
return err
|
||
|
|
}
|
||
|
|
|
||
|
|
// ExecX is like Exec, but panics if an error occurs.
|
||
|
|
func (_c *BatchImageItemCreate) ExecX(ctx context.Context) {
|
||
|
|
if err := _c.Exec(ctx); err != nil {
|
||
|
|
panic(err)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
// defaults sets the default values of the builder before save.
|
||
|
|
func (_c *BatchImageItemCreate) defaults() {
|
||
|
|
if _, ok := _c.mutation.ImageCount(); !ok {
|
||
|
|
v := batchimageitem.DefaultImageCount
|
||
|
|
_c.mutation.SetImageCount(v)
|
||
|
|
}
|
||
|
|
if _, ok := _c.mutation.CreatedAt(); !ok {
|
||
|
|
v := batchimageitem.DefaultCreatedAt()
|
||
|
|
_c.mutation.SetCreatedAt(v)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
// check runs all checks and user-defined validators on the builder.
|
||
|
|
func (_c *BatchImageItemCreate) check() error {
|
||
|
|
if _, ok := _c.mutation.JobID(); !ok {
|
||
|
|
return &ValidationError{Name: "job_id", err: errors.New(`ent: missing required field "BatchImageItem.job_id"`)}
|
||
|
|
}
|
||
|
|
if v, ok := _c.mutation.JobID(); ok {
|
||
|
|
if err := batchimageitem.JobIDValidator(v); err != nil {
|
||
|
|
return &ValidationError{Name: "job_id", err: fmt.Errorf(`ent: validator failed for field "BatchImageItem.job_id": %w`, err)}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
if _, ok := _c.mutation.CustomID(); !ok {
|
||
|
|
return &ValidationError{Name: "custom_id", err: errors.New(`ent: missing required field "BatchImageItem.custom_id"`)}
|
||
|
|
}
|
||
|
|
if v, ok := _c.mutation.CustomID(); ok {
|
||
|
|
if err := batchimageitem.CustomIDValidator(v); err != nil {
|
||
|
|
return &ValidationError{Name: "custom_id", err: fmt.Errorf(`ent: validator failed for field "BatchImageItem.custom_id": %w`, err)}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
if _, ok := _c.mutation.Status(); !ok {
|
||
|
|
return &ValidationError{Name: "status", err: errors.New(`ent: missing required field "BatchImageItem.status"`)}
|
||
|
|
}
|
||
|
|
if v, ok := _c.mutation.Status(); ok {
|
||
|
|
if err := batchimageitem.StatusValidator(v); err != nil {
|
||
|
|
return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "BatchImageItem.status": %w`, err)}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
if v, ok := _c.mutation.RequestHash(); ok {
|
||
|
|
if err := batchimageitem.RequestHashValidator(v); err != nil {
|
||
|
|
return &ValidationError{Name: "request_hash", err: fmt.Errorf(`ent: validator failed for field "BatchImageItem.request_hash": %w`, err)}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
if v, ok := _c.mutation.ProviderSourceObject(); ok {
|
||
|
|
if err := batchimageitem.ProviderSourceObjectValidator(v); err != nil {
|
||
|
|
return &ValidationError{Name: "provider_source_object", err: fmt.Errorf(`ent: validator failed for field "BatchImageItem.provider_source_object": %w`, err)}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
if v, ok := _c.mutation.MimeType(); ok {
|
||
|
|
if err := batchimageitem.MimeTypeValidator(v); err != nil {
|
||
|
|
return &ValidationError{Name: "mime_type", err: fmt.Errorf(`ent: validator failed for field "BatchImageItem.mime_type": %w`, err)}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
if v, ok := _c.mutation.FileExtension(); ok {
|
||
|
|
if err := batchimageitem.FileExtensionValidator(v); err != nil {
|
||
|
|
return &ValidationError{Name: "file_extension", err: fmt.Errorf(`ent: validator failed for field "BatchImageItem.file_extension": %w`, err)}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
if _, ok := _c.mutation.ImageCount(); !ok {
|
||
|
|
return &ValidationError{Name: "image_count", err: errors.New(`ent: missing required field "BatchImageItem.image_count"`)}
|
||
|
|
}
|
||
|
|
if v, ok := _c.mutation.ErrorCode(); ok {
|
||
|
|
if err := batchimageitem.ErrorCodeValidator(v); err != nil {
|
||
|
|
return &ValidationError{Name: "error_code", err: fmt.Errorf(`ent: validator failed for field "BatchImageItem.error_code": %w`, err)}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
if _, ok := _c.mutation.CreatedAt(); !ok {
|
||
|
|
return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "BatchImageItem.created_at"`)}
|
||
|
|
}
|
||
|
|
return nil
|
||
|
|
}
|
||
|
|
|
||
|
|
func (_c *BatchImageItemCreate) sqlSave(ctx context.Context) (*BatchImageItem, error) {
|
||
|
|
if err := _c.check(); err != nil {
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
_node, _spec := _c.createSpec()
|
||
|
|
if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil {
|
||
|
|
if sqlgraph.IsConstraintError(err) {
|
||
|
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||
|
|
}
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
id := _spec.ID.Value.(int64)
|
||
|
|
_node.ID = int64(id)
|
||
|
|
_c.mutation.id = &_node.ID
|
||
|
|
_c.mutation.done = true
|
||
|
|
return _node, nil
|
||
|
|
}
|
||
|
|
|
||
|
|
func (_c *BatchImageItemCreate) createSpec() (*BatchImageItem, *sqlgraph.CreateSpec) {
|
||
|
|
var (
|
||
|
|
_node = &BatchImageItem{config: _c.config}
|
||
|
|
_spec = sqlgraph.NewCreateSpec(batchimageitem.Table, sqlgraph.NewFieldSpec(batchimageitem.FieldID, field.TypeInt64))
|
||
|
|
)
|
||
|
|
_spec.OnConflict = _c.conflict
|
||
|
|
if value, ok := _c.mutation.JobID(); ok {
|
||
|
|
_spec.SetField(batchimageitem.FieldJobID, field.TypeString, value)
|
||
|
|
_node.JobID = value
|
||
|
|
}
|
||
|
|
if value, ok := _c.mutation.CustomID(); ok {
|
||
|
|
_spec.SetField(batchimageitem.FieldCustomID, field.TypeString, value)
|
||
|
|
_node.CustomID = value
|
||
|
|
}
|
||
|
|
if value, ok := _c.mutation.Status(); ok {
|
||
|
|
_spec.SetField(batchimageitem.FieldStatus, field.TypeString, value)
|
||
|
|
_node.Status = value
|
||
|
|
}
|
||
|
|
if value, ok := _c.mutation.RequestHash(); ok {
|
||
|
|
_spec.SetField(batchimageitem.FieldRequestHash, field.TypeString, value)
|
||
|
|
_node.RequestHash = &value
|
||
|
|
}
|
||
|
|
if value, ok := _c.mutation.PromptPreview(); ok {
|
||
|
|
_spec.SetField(batchimageitem.FieldPromptPreview, field.TypeString, value)
|
||
|
|
_node.PromptPreview = &value
|
||
|
|
}
|
||
|
|
if value, ok := _c.mutation.ProviderSourceObject(); ok {
|
||
|
|
_spec.SetField(batchimageitem.FieldProviderSourceObject, field.TypeString, value)
|
||
|
|
_node.ProviderSourceObject = &value
|
||
|
|
}
|
||
|
|
if value, ok := _c.mutation.SourceLineNumber(); ok {
|
||
|
|
_spec.SetField(batchimageitem.FieldSourceLineNumber, field.TypeInt, value)
|
||
|
|
_node.SourceLineNumber = &value
|
||
|
|
}
|
||
|
|
if value, ok := _c.mutation.SourceByteOffset(); ok {
|
||
|
|
_spec.SetField(batchimageitem.FieldSourceByteOffset, field.TypeInt64, value)
|
||
|
|
_node.SourceByteOffset = &value
|
||
|
|
}
|
||
|
|
if value, ok := _c.mutation.SourceByteLength(); ok {
|
||
|
|
_spec.SetField(batchimageitem.FieldSourceByteLength, field.TypeInt64, value)
|
||
|
|
_node.SourceByteLength = &value
|
||
|
|
}
|
||
|
|
if value, ok := _c.mutation.MimeType(); ok {
|
||
|
|
_spec.SetField(batchimageitem.FieldMimeType, field.TypeString, value)
|
||
|
|
_node.MimeType = &value
|
||
|
|
}
|
||
|
|
if value, ok := _c.mutation.FileExtension(); ok {
|
||
|
|
_spec.SetField(batchimageitem.FieldFileExtension, field.TypeString, value)
|
||
|
|
_node.FileExtension = &value
|
||
|
|
}
|
||
|
|
if value, ok := _c.mutation.ImageCount(); ok {
|
||
|
|
_spec.SetField(batchimageitem.FieldImageCount, field.TypeInt, value)
|
||
|
|
_node.ImageCount = value
|
||
|
|
}
|
||
|
|
if value, ok := _c.mutation.ErrorCode(); ok {
|
||
|
|
_spec.SetField(batchimageitem.FieldErrorCode, field.TypeString, value)
|
||
|
|
_node.ErrorCode = &value
|
||
|
|
}
|
||
|
|
if value, ok := _c.mutation.ErrorMessage(); ok {
|
||
|
|
_spec.SetField(batchimageitem.FieldErrorMessage, field.TypeString, value)
|
||
|
|
_node.ErrorMessage = &value
|
||
|
|
}
|
||
|
|
if value, ok := _c.mutation.BilledAmount(); ok {
|
||
|
|
_spec.SetField(batchimageitem.FieldBilledAmount, field.TypeFloat64, value)
|
||
|
|
_node.BilledAmount = &value
|
||
|
|
}
|
||
|
|
if value, ok := _c.mutation.CreatedAt(); ok {
|
||
|
|
_spec.SetField(batchimageitem.FieldCreatedAt, field.TypeTime, value)
|
||
|
|
_node.CreatedAt = value
|
||
|
|
}
|
||
|
|
if value, ok := _c.mutation.IndexedAt(); ok {
|
||
|
|
_spec.SetField(batchimageitem.FieldIndexedAt, field.TypeTime, value)
|
||
|
|
_node.IndexedAt = &value
|
||
|
|
}
|
||
|
|
return _node, _spec
|
||
|
|
}
|
||
|
|
|
||
|
|
// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
|
||
|
|
// of the `INSERT` statement. For example:
|
||
|
|
//
|
||
|
|
// client.BatchImageItem.Create().
|
||
|
|
// SetJobID(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.BatchImageItemUpsert) {
|
||
|
|
// SetJobID(v+v).
|
||
|
|
// }).
|
||
|
|
// Exec(ctx)
|
||
|
|
func (_c *BatchImageItemCreate) OnConflict(opts ...sql.ConflictOption) *BatchImageItemUpsertOne {
|
||
|
|
_c.conflict = opts
|
||
|
|
return &BatchImageItemUpsertOne{
|
||
|
|
create: _c,
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
// OnConflictColumns calls `OnConflict` and configures the columns
|
||
|
|
// as conflict target. Using this option is equivalent to using:
|
||
|
|
//
|
||
|
|
// client.BatchImageItem.Create().
|
||
|
|
// OnConflict(sql.ConflictColumns(columns...)).
|
||
|
|
// Exec(ctx)
|
||
|
|
func (_c *BatchImageItemCreate) OnConflictColumns(columns ...string) *BatchImageItemUpsertOne {
|
||
|
|
_c.conflict = append(_c.conflict, sql.ConflictColumns(columns...))
|
||
|
|
return &BatchImageItemUpsertOne{
|
||
|
|
create: _c,
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
type (
|
||
|
|
// BatchImageItemUpsertOne is the builder for "upsert"-ing
|
||
|
|
// one BatchImageItem node.
|
||
|
|
BatchImageItemUpsertOne struct {
|
||
|
|
create *BatchImageItemCreate
|
||
|
|
}
|
||
|
|
|
||
|
|
// BatchImageItemUpsert is the "OnConflict" setter.
|
||
|
|
BatchImageItemUpsert struct {
|
||
|
|
*sql.UpdateSet
|
||
|
|
}
|
||
|
|
)
|
||
|
|
|
||
|
|
// SetJobID sets the "job_id" field.
|
||
|
|
func (u *BatchImageItemUpsert) SetJobID(v string) *BatchImageItemUpsert {
|
||
|
|
u.Set(batchimageitem.FieldJobID, v)
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdateJobID sets the "job_id" field to the value that was provided on create.
|
||
|
|
func (u *BatchImageItemUpsert) UpdateJobID() *BatchImageItemUpsert {
|
||
|
|
u.SetExcluded(batchimageitem.FieldJobID)
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetCustomID sets the "custom_id" field.
|
||
|
|
func (u *BatchImageItemUpsert) SetCustomID(v string) *BatchImageItemUpsert {
|
||
|
|
u.Set(batchimageitem.FieldCustomID, v)
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdateCustomID sets the "custom_id" field to the value that was provided on create.
|
||
|
|
func (u *BatchImageItemUpsert) UpdateCustomID() *BatchImageItemUpsert {
|
||
|
|
u.SetExcluded(batchimageitem.FieldCustomID)
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetStatus sets the "status" field.
|
||
|
|
func (u *BatchImageItemUpsert) SetStatus(v string) *BatchImageItemUpsert {
|
||
|
|
u.Set(batchimageitem.FieldStatus, v)
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdateStatus sets the "status" field to the value that was provided on create.
|
||
|
|
func (u *BatchImageItemUpsert) UpdateStatus() *BatchImageItemUpsert {
|
||
|
|
u.SetExcluded(batchimageitem.FieldStatus)
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetRequestHash sets the "request_hash" field.
|
||
|
|
func (u *BatchImageItemUpsert) SetRequestHash(v string) *BatchImageItemUpsert {
|
||
|
|
u.Set(batchimageitem.FieldRequestHash, v)
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdateRequestHash sets the "request_hash" field to the value that was provided on create.
|
||
|
|
func (u *BatchImageItemUpsert) UpdateRequestHash() *BatchImageItemUpsert {
|
||
|
|
u.SetExcluded(batchimageitem.FieldRequestHash)
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearRequestHash clears the value of the "request_hash" field.
|
||
|
|
func (u *BatchImageItemUpsert) ClearRequestHash() *BatchImageItemUpsert {
|
||
|
|
u.SetNull(batchimageitem.FieldRequestHash)
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetPromptPreview sets the "prompt_preview" field.
|
||
|
|
func (u *BatchImageItemUpsert) SetPromptPreview(v string) *BatchImageItemUpsert {
|
||
|
|
u.Set(batchimageitem.FieldPromptPreview, v)
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdatePromptPreview sets the "prompt_preview" field to the value that was provided on create.
|
||
|
|
func (u *BatchImageItemUpsert) UpdatePromptPreview() *BatchImageItemUpsert {
|
||
|
|
u.SetExcluded(batchimageitem.FieldPromptPreview)
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearPromptPreview clears the value of the "prompt_preview" field.
|
||
|
|
func (u *BatchImageItemUpsert) ClearPromptPreview() *BatchImageItemUpsert {
|
||
|
|
u.SetNull(batchimageitem.FieldPromptPreview)
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetProviderSourceObject sets the "provider_source_object" field.
|
||
|
|
func (u *BatchImageItemUpsert) SetProviderSourceObject(v string) *BatchImageItemUpsert {
|
||
|
|
u.Set(batchimageitem.FieldProviderSourceObject, v)
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdateProviderSourceObject sets the "provider_source_object" field to the value that was provided on create.
|
||
|
|
func (u *BatchImageItemUpsert) UpdateProviderSourceObject() *BatchImageItemUpsert {
|
||
|
|
u.SetExcluded(batchimageitem.FieldProviderSourceObject)
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearProviderSourceObject clears the value of the "provider_source_object" field.
|
||
|
|
func (u *BatchImageItemUpsert) ClearProviderSourceObject() *BatchImageItemUpsert {
|
||
|
|
u.SetNull(batchimageitem.FieldProviderSourceObject)
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetSourceLineNumber sets the "source_line_number" field.
|
||
|
|
func (u *BatchImageItemUpsert) SetSourceLineNumber(v int) *BatchImageItemUpsert {
|
||
|
|
u.Set(batchimageitem.FieldSourceLineNumber, v)
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdateSourceLineNumber sets the "source_line_number" field to the value that was provided on create.
|
||
|
|
func (u *BatchImageItemUpsert) UpdateSourceLineNumber() *BatchImageItemUpsert {
|
||
|
|
u.SetExcluded(batchimageitem.FieldSourceLineNumber)
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// AddSourceLineNumber adds v to the "source_line_number" field.
|
||
|
|
func (u *BatchImageItemUpsert) AddSourceLineNumber(v int) *BatchImageItemUpsert {
|
||
|
|
u.Add(batchimageitem.FieldSourceLineNumber, v)
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearSourceLineNumber clears the value of the "source_line_number" field.
|
||
|
|
func (u *BatchImageItemUpsert) ClearSourceLineNumber() *BatchImageItemUpsert {
|
||
|
|
u.SetNull(batchimageitem.FieldSourceLineNumber)
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetSourceByteOffset sets the "source_byte_offset" field.
|
||
|
|
func (u *BatchImageItemUpsert) SetSourceByteOffset(v int64) *BatchImageItemUpsert {
|
||
|
|
u.Set(batchimageitem.FieldSourceByteOffset, v)
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdateSourceByteOffset sets the "source_byte_offset" field to the value that was provided on create.
|
||
|
|
func (u *BatchImageItemUpsert) UpdateSourceByteOffset() *BatchImageItemUpsert {
|
||
|
|
u.SetExcluded(batchimageitem.FieldSourceByteOffset)
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// AddSourceByteOffset adds v to the "source_byte_offset" field.
|
||
|
|
func (u *BatchImageItemUpsert) AddSourceByteOffset(v int64) *BatchImageItemUpsert {
|
||
|
|
u.Add(batchimageitem.FieldSourceByteOffset, v)
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearSourceByteOffset clears the value of the "source_byte_offset" field.
|
||
|
|
func (u *BatchImageItemUpsert) ClearSourceByteOffset() *BatchImageItemUpsert {
|
||
|
|
u.SetNull(batchimageitem.FieldSourceByteOffset)
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetSourceByteLength sets the "source_byte_length" field.
|
||
|
|
func (u *BatchImageItemUpsert) SetSourceByteLength(v int64) *BatchImageItemUpsert {
|
||
|
|
u.Set(batchimageitem.FieldSourceByteLength, v)
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdateSourceByteLength sets the "source_byte_length" field to the value that was provided on create.
|
||
|
|
func (u *BatchImageItemUpsert) UpdateSourceByteLength() *BatchImageItemUpsert {
|
||
|
|
u.SetExcluded(batchimageitem.FieldSourceByteLength)
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// AddSourceByteLength adds v to the "source_byte_length" field.
|
||
|
|
func (u *BatchImageItemUpsert) AddSourceByteLength(v int64) *BatchImageItemUpsert {
|
||
|
|
u.Add(batchimageitem.FieldSourceByteLength, v)
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearSourceByteLength clears the value of the "source_byte_length" field.
|
||
|
|
func (u *BatchImageItemUpsert) ClearSourceByteLength() *BatchImageItemUpsert {
|
||
|
|
u.SetNull(batchimageitem.FieldSourceByteLength)
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetMimeType sets the "mime_type" field.
|
||
|
|
func (u *BatchImageItemUpsert) SetMimeType(v string) *BatchImageItemUpsert {
|
||
|
|
u.Set(batchimageitem.FieldMimeType, v)
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdateMimeType sets the "mime_type" field to the value that was provided on create.
|
||
|
|
func (u *BatchImageItemUpsert) UpdateMimeType() *BatchImageItemUpsert {
|
||
|
|
u.SetExcluded(batchimageitem.FieldMimeType)
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearMimeType clears the value of the "mime_type" field.
|
||
|
|
func (u *BatchImageItemUpsert) ClearMimeType() *BatchImageItemUpsert {
|
||
|
|
u.SetNull(batchimageitem.FieldMimeType)
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetFileExtension sets the "file_extension" field.
|
||
|
|
func (u *BatchImageItemUpsert) SetFileExtension(v string) *BatchImageItemUpsert {
|
||
|
|
u.Set(batchimageitem.FieldFileExtension, v)
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdateFileExtension sets the "file_extension" field to the value that was provided on create.
|
||
|
|
func (u *BatchImageItemUpsert) UpdateFileExtension() *BatchImageItemUpsert {
|
||
|
|
u.SetExcluded(batchimageitem.FieldFileExtension)
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearFileExtension clears the value of the "file_extension" field.
|
||
|
|
func (u *BatchImageItemUpsert) ClearFileExtension() *BatchImageItemUpsert {
|
||
|
|
u.SetNull(batchimageitem.FieldFileExtension)
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetImageCount sets the "image_count" field.
|
||
|
|
func (u *BatchImageItemUpsert) SetImageCount(v int) *BatchImageItemUpsert {
|
||
|
|
u.Set(batchimageitem.FieldImageCount, v)
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdateImageCount sets the "image_count" field to the value that was provided on create.
|
||
|
|
func (u *BatchImageItemUpsert) UpdateImageCount() *BatchImageItemUpsert {
|
||
|
|
u.SetExcluded(batchimageitem.FieldImageCount)
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// AddImageCount adds v to the "image_count" field.
|
||
|
|
func (u *BatchImageItemUpsert) AddImageCount(v int) *BatchImageItemUpsert {
|
||
|
|
u.Add(batchimageitem.FieldImageCount, v)
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetErrorCode sets the "error_code" field.
|
||
|
|
func (u *BatchImageItemUpsert) SetErrorCode(v string) *BatchImageItemUpsert {
|
||
|
|
u.Set(batchimageitem.FieldErrorCode, v)
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdateErrorCode sets the "error_code" field to the value that was provided on create.
|
||
|
|
func (u *BatchImageItemUpsert) UpdateErrorCode() *BatchImageItemUpsert {
|
||
|
|
u.SetExcluded(batchimageitem.FieldErrorCode)
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearErrorCode clears the value of the "error_code" field.
|
||
|
|
func (u *BatchImageItemUpsert) ClearErrorCode() *BatchImageItemUpsert {
|
||
|
|
u.SetNull(batchimageitem.FieldErrorCode)
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetErrorMessage sets the "error_message" field.
|
||
|
|
func (u *BatchImageItemUpsert) SetErrorMessage(v string) *BatchImageItemUpsert {
|
||
|
|
u.Set(batchimageitem.FieldErrorMessage, v)
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdateErrorMessage sets the "error_message" field to the value that was provided on create.
|
||
|
|
func (u *BatchImageItemUpsert) UpdateErrorMessage() *BatchImageItemUpsert {
|
||
|
|
u.SetExcluded(batchimageitem.FieldErrorMessage)
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearErrorMessage clears the value of the "error_message" field.
|
||
|
|
func (u *BatchImageItemUpsert) ClearErrorMessage() *BatchImageItemUpsert {
|
||
|
|
u.SetNull(batchimageitem.FieldErrorMessage)
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetBilledAmount sets the "billed_amount" field.
|
||
|
|
func (u *BatchImageItemUpsert) SetBilledAmount(v float64) *BatchImageItemUpsert {
|
||
|
|
u.Set(batchimageitem.FieldBilledAmount, v)
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdateBilledAmount sets the "billed_amount" field to the value that was provided on create.
|
||
|
|
func (u *BatchImageItemUpsert) UpdateBilledAmount() *BatchImageItemUpsert {
|
||
|
|
u.SetExcluded(batchimageitem.FieldBilledAmount)
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// AddBilledAmount adds v to the "billed_amount" field.
|
||
|
|
func (u *BatchImageItemUpsert) AddBilledAmount(v float64) *BatchImageItemUpsert {
|
||
|
|
u.Add(batchimageitem.FieldBilledAmount, v)
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearBilledAmount clears the value of the "billed_amount" field.
|
||
|
|
func (u *BatchImageItemUpsert) ClearBilledAmount() *BatchImageItemUpsert {
|
||
|
|
u.SetNull(batchimageitem.FieldBilledAmount)
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetIndexedAt sets the "indexed_at" field.
|
||
|
|
func (u *BatchImageItemUpsert) SetIndexedAt(v time.Time) *BatchImageItemUpsert {
|
||
|
|
u.Set(batchimageitem.FieldIndexedAt, v)
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdateIndexedAt sets the "indexed_at" field to the value that was provided on create.
|
||
|
|
func (u *BatchImageItemUpsert) UpdateIndexedAt() *BatchImageItemUpsert {
|
||
|
|
u.SetExcluded(batchimageitem.FieldIndexedAt)
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearIndexedAt clears the value of the "indexed_at" field.
|
||
|
|
func (u *BatchImageItemUpsert) ClearIndexedAt() *BatchImageItemUpsert {
|
||
|
|
u.SetNull(batchimageitem.FieldIndexedAt)
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdateNewValues updates the mutable fields using the new values that were set on create.
|
||
|
|
// Using this option is equivalent to using:
|
||
|
|
//
|
||
|
|
// client.BatchImageItem.Create().
|
||
|
|
// OnConflict(
|
||
|
|
// sql.ResolveWithNewValues(),
|
||
|
|
// ).
|
||
|
|
// Exec(ctx)
|
||
|
|
func (u *BatchImageItemUpsertOne) UpdateNewValues() *BatchImageItemUpsertOne {
|
||
|
|
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.CreatedAt(); exists {
|
||
|
|
s.SetIgnore(batchimageitem.FieldCreatedAt)
|
||
|
|
}
|
||
|
|
}))
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// Ignore sets each column to itself in case of conflict.
|
||
|
|
// Using this option is equivalent to using:
|
||
|
|
//
|
||
|
|
// client.BatchImageItem.Create().
|
||
|
|
// OnConflict(sql.ResolveWithIgnore()).
|
||
|
|
// Exec(ctx)
|
||
|
|
func (u *BatchImageItemUpsertOne) Ignore() *BatchImageItemUpsertOne {
|
||
|
|
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 *BatchImageItemUpsertOne) DoNothing() *BatchImageItemUpsertOne {
|
||
|
|
u.create.conflict = append(u.create.conflict, sql.DoNothing())
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// Update allows overriding fields `UPDATE` values. See the BatchImageItemCreate.OnConflict
|
||
|
|
// documentation for more info.
|
||
|
|
func (u *BatchImageItemUpsertOne) Update(set func(*BatchImageItemUpsert)) *BatchImageItemUpsertOne {
|
||
|
|
u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
|
||
|
|
set(&BatchImageItemUpsert{UpdateSet: update})
|
||
|
|
}))
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetJobID sets the "job_id" field.
|
||
|
|
func (u *BatchImageItemUpsertOne) SetJobID(v string) *BatchImageItemUpsertOne {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.SetJobID(v)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdateJobID sets the "job_id" field to the value that was provided on create.
|
||
|
|
func (u *BatchImageItemUpsertOne) UpdateJobID() *BatchImageItemUpsertOne {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.UpdateJobID()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetCustomID sets the "custom_id" field.
|
||
|
|
func (u *BatchImageItemUpsertOne) SetCustomID(v string) *BatchImageItemUpsertOne {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.SetCustomID(v)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdateCustomID sets the "custom_id" field to the value that was provided on create.
|
||
|
|
func (u *BatchImageItemUpsertOne) UpdateCustomID() *BatchImageItemUpsertOne {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.UpdateCustomID()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetStatus sets the "status" field.
|
||
|
|
func (u *BatchImageItemUpsertOne) SetStatus(v string) *BatchImageItemUpsertOne {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.SetStatus(v)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdateStatus sets the "status" field to the value that was provided on create.
|
||
|
|
func (u *BatchImageItemUpsertOne) UpdateStatus() *BatchImageItemUpsertOne {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.UpdateStatus()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetRequestHash sets the "request_hash" field.
|
||
|
|
func (u *BatchImageItemUpsertOne) SetRequestHash(v string) *BatchImageItemUpsertOne {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.SetRequestHash(v)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdateRequestHash sets the "request_hash" field to the value that was provided on create.
|
||
|
|
func (u *BatchImageItemUpsertOne) UpdateRequestHash() *BatchImageItemUpsertOne {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.UpdateRequestHash()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearRequestHash clears the value of the "request_hash" field.
|
||
|
|
func (u *BatchImageItemUpsertOne) ClearRequestHash() *BatchImageItemUpsertOne {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.ClearRequestHash()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetPromptPreview sets the "prompt_preview" field.
|
||
|
|
func (u *BatchImageItemUpsertOne) SetPromptPreview(v string) *BatchImageItemUpsertOne {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.SetPromptPreview(v)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdatePromptPreview sets the "prompt_preview" field to the value that was provided on create.
|
||
|
|
func (u *BatchImageItemUpsertOne) UpdatePromptPreview() *BatchImageItemUpsertOne {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.UpdatePromptPreview()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearPromptPreview clears the value of the "prompt_preview" field.
|
||
|
|
func (u *BatchImageItemUpsertOne) ClearPromptPreview() *BatchImageItemUpsertOne {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.ClearPromptPreview()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetProviderSourceObject sets the "provider_source_object" field.
|
||
|
|
func (u *BatchImageItemUpsertOne) SetProviderSourceObject(v string) *BatchImageItemUpsertOne {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.SetProviderSourceObject(v)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdateProviderSourceObject sets the "provider_source_object" field to the value that was provided on create.
|
||
|
|
func (u *BatchImageItemUpsertOne) UpdateProviderSourceObject() *BatchImageItemUpsertOne {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.UpdateProviderSourceObject()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearProviderSourceObject clears the value of the "provider_source_object" field.
|
||
|
|
func (u *BatchImageItemUpsertOne) ClearProviderSourceObject() *BatchImageItemUpsertOne {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.ClearProviderSourceObject()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetSourceLineNumber sets the "source_line_number" field.
|
||
|
|
func (u *BatchImageItemUpsertOne) SetSourceLineNumber(v int) *BatchImageItemUpsertOne {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.SetSourceLineNumber(v)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// AddSourceLineNumber adds v to the "source_line_number" field.
|
||
|
|
func (u *BatchImageItemUpsertOne) AddSourceLineNumber(v int) *BatchImageItemUpsertOne {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.AddSourceLineNumber(v)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdateSourceLineNumber sets the "source_line_number" field to the value that was provided on create.
|
||
|
|
func (u *BatchImageItemUpsertOne) UpdateSourceLineNumber() *BatchImageItemUpsertOne {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.UpdateSourceLineNumber()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearSourceLineNumber clears the value of the "source_line_number" field.
|
||
|
|
func (u *BatchImageItemUpsertOne) ClearSourceLineNumber() *BatchImageItemUpsertOne {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.ClearSourceLineNumber()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetSourceByteOffset sets the "source_byte_offset" field.
|
||
|
|
func (u *BatchImageItemUpsertOne) SetSourceByteOffset(v int64) *BatchImageItemUpsertOne {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.SetSourceByteOffset(v)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// AddSourceByteOffset adds v to the "source_byte_offset" field.
|
||
|
|
func (u *BatchImageItemUpsertOne) AddSourceByteOffset(v int64) *BatchImageItemUpsertOne {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.AddSourceByteOffset(v)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdateSourceByteOffset sets the "source_byte_offset" field to the value that was provided on create.
|
||
|
|
func (u *BatchImageItemUpsertOne) UpdateSourceByteOffset() *BatchImageItemUpsertOne {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.UpdateSourceByteOffset()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearSourceByteOffset clears the value of the "source_byte_offset" field.
|
||
|
|
func (u *BatchImageItemUpsertOne) ClearSourceByteOffset() *BatchImageItemUpsertOne {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.ClearSourceByteOffset()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetSourceByteLength sets the "source_byte_length" field.
|
||
|
|
func (u *BatchImageItemUpsertOne) SetSourceByteLength(v int64) *BatchImageItemUpsertOne {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.SetSourceByteLength(v)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// AddSourceByteLength adds v to the "source_byte_length" field.
|
||
|
|
func (u *BatchImageItemUpsertOne) AddSourceByteLength(v int64) *BatchImageItemUpsertOne {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.AddSourceByteLength(v)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdateSourceByteLength sets the "source_byte_length" field to the value that was provided on create.
|
||
|
|
func (u *BatchImageItemUpsertOne) UpdateSourceByteLength() *BatchImageItemUpsertOne {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.UpdateSourceByteLength()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearSourceByteLength clears the value of the "source_byte_length" field.
|
||
|
|
func (u *BatchImageItemUpsertOne) ClearSourceByteLength() *BatchImageItemUpsertOne {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.ClearSourceByteLength()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetMimeType sets the "mime_type" field.
|
||
|
|
func (u *BatchImageItemUpsertOne) SetMimeType(v string) *BatchImageItemUpsertOne {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.SetMimeType(v)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdateMimeType sets the "mime_type" field to the value that was provided on create.
|
||
|
|
func (u *BatchImageItemUpsertOne) UpdateMimeType() *BatchImageItemUpsertOne {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.UpdateMimeType()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearMimeType clears the value of the "mime_type" field.
|
||
|
|
func (u *BatchImageItemUpsertOne) ClearMimeType() *BatchImageItemUpsertOne {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.ClearMimeType()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetFileExtension sets the "file_extension" field.
|
||
|
|
func (u *BatchImageItemUpsertOne) SetFileExtension(v string) *BatchImageItemUpsertOne {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.SetFileExtension(v)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdateFileExtension sets the "file_extension" field to the value that was provided on create.
|
||
|
|
func (u *BatchImageItemUpsertOne) UpdateFileExtension() *BatchImageItemUpsertOne {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.UpdateFileExtension()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearFileExtension clears the value of the "file_extension" field.
|
||
|
|
func (u *BatchImageItemUpsertOne) ClearFileExtension() *BatchImageItemUpsertOne {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.ClearFileExtension()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetImageCount sets the "image_count" field.
|
||
|
|
func (u *BatchImageItemUpsertOne) SetImageCount(v int) *BatchImageItemUpsertOne {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.SetImageCount(v)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// AddImageCount adds v to the "image_count" field.
|
||
|
|
func (u *BatchImageItemUpsertOne) AddImageCount(v int) *BatchImageItemUpsertOne {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.AddImageCount(v)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdateImageCount sets the "image_count" field to the value that was provided on create.
|
||
|
|
func (u *BatchImageItemUpsertOne) UpdateImageCount() *BatchImageItemUpsertOne {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.UpdateImageCount()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetErrorCode sets the "error_code" field.
|
||
|
|
func (u *BatchImageItemUpsertOne) SetErrorCode(v string) *BatchImageItemUpsertOne {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.SetErrorCode(v)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdateErrorCode sets the "error_code" field to the value that was provided on create.
|
||
|
|
func (u *BatchImageItemUpsertOne) UpdateErrorCode() *BatchImageItemUpsertOne {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.UpdateErrorCode()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearErrorCode clears the value of the "error_code" field.
|
||
|
|
func (u *BatchImageItemUpsertOne) ClearErrorCode() *BatchImageItemUpsertOne {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.ClearErrorCode()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetErrorMessage sets the "error_message" field.
|
||
|
|
func (u *BatchImageItemUpsertOne) SetErrorMessage(v string) *BatchImageItemUpsertOne {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.SetErrorMessage(v)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdateErrorMessage sets the "error_message" field to the value that was provided on create.
|
||
|
|
func (u *BatchImageItemUpsertOne) UpdateErrorMessage() *BatchImageItemUpsertOne {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.UpdateErrorMessage()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearErrorMessage clears the value of the "error_message" field.
|
||
|
|
func (u *BatchImageItemUpsertOne) ClearErrorMessage() *BatchImageItemUpsertOne {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.ClearErrorMessage()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetBilledAmount sets the "billed_amount" field.
|
||
|
|
func (u *BatchImageItemUpsertOne) SetBilledAmount(v float64) *BatchImageItemUpsertOne {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.SetBilledAmount(v)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// AddBilledAmount adds v to the "billed_amount" field.
|
||
|
|
func (u *BatchImageItemUpsertOne) AddBilledAmount(v float64) *BatchImageItemUpsertOne {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.AddBilledAmount(v)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdateBilledAmount sets the "billed_amount" field to the value that was provided on create.
|
||
|
|
func (u *BatchImageItemUpsertOne) UpdateBilledAmount() *BatchImageItemUpsertOne {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.UpdateBilledAmount()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearBilledAmount clears the value of the "billed_amount" field.
|
||
|
|
func (u *BatchImageItemUpsertOne) ClearBilledAmount() *BatchImageItemUpsertOne {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.ClearBilledAmount()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetIndexedAt sets the "indexed_at" field.
|
||
|
|
func (u *BatchImageItemUpsertOne) SetIndexedAt(v time.Time) *BatchImageItemUpsertOne {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.SetIndexedAt(v)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdateIndexedAt sets the "indexed_at" field to the value that was provided on create.
|
||
|
|
func (u *BatchImageItemUpsertOne) UpdateIndexedAt() *BatchImageItemUpsertOne {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.UpdateIndexedAt()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearIndexedAt clears the value of the "indexed_at" field.
|
||
|
|
func (u *BatchImageItemUpsertOne) ClearIndexedAt() *BatchImageItemUpsertOne {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.ClearIndexedAt()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// Exec executes the query.
|
||
|
|
func (u *BatchImageItemUpsertOne) Exec(ctx context.Context) error {
|
||
|
|
if len(u.create.conflict) == 0 {
|
||
|
|
return errors.New("ent: missing options for BatchImageItemCreate.OnConflict")
|
||
|
|
}
|
||
|
|
return u.create.Exec(ctx)
|
||
|
|
}
|
||
|
|
|
||
|
|
// ExecX is like Exec, but panics if an error occurs.
|
||
|
|
func (u *BatchImageItemUpsertOne) 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 *BatchImageItemUpsertOne) ID(ctx context.Context) (id int64, err error) {
|
||
|
|
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 *BatchImageItemUpsertOne) IDX(ctx context.Context) int64 {
|
||
|
|
id, err := u.ID(ctx)
|
||
|
|
if err != nil {
|
||
|
|
panic(err)
|
||
|
|
}
|
||
|
|
return id
|
||
|
|
}
|
||
|
|
|
||
|
|
// BatchImageItemCreateBulk is the builder for creating many BatchImageItem entities in bulk.
|
||
|
|
type BatchImageItemCreateBulk struct {
|
||
|
|
config
|
||
|
|
err error
|
||
|
|
builders []*BatchImageItemCreate
|
||
|
|
conflict []sql.ConflictOption
|
||
|
|
}
|
||
|
|
|
||
|
|
// Save creates the BatchImageItem entities in the database.
|
||
|
|
func (_c *BatchImageItemCreateBulk) Save(ctx context.Context) ([]*BatchImageItem, error) {
|
||
|
|
if _c.err != nil {
|
||
|
|
return nil, _c.err
|
||
|
|
}
|
||
|
|
specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
|
||
|
|
nodes := make([]*BatchImageItem, len(_c.builders))
|
||
|
|
mutators := make([]Mutator, len(_c.builders))
|
||
|
|
for i := range _c.builders {
|
||
|
|
func(i int, root context.Context) {
|
||
|
|
builder := _c.builders[i]
|
||
|
|
builder.defaults()
|
||
|
|
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||
|
|
mutation, ok := m.(*BatchImageItemMutation)
|
||
|
|
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, _c.builders[i+1].mutation)
|
||
|
|
} else {
|
||
|
|
spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
|
||
|
|
spec.OnConflict = _c.conflict
|
||
|
|
// Invoke the actual operation on the latest mutation in the chain.
|
||
|
|
if err = sqlgraph.BatchCreate(ctx, _c.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
|
||
|
|
if specs[i].ID.Value != nil {
|
||
|
|
id := specs[i].ID.Value.(int64)
|
||
|
|
nodes[i].ID = int64(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, _c.builders[0].mutation); err != nil {
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
}
|
||
|
|
return nodes, nil
|
||
|
|
}
|
||
|
|
|
||
|
|
// SaveX is like Save, but panics if an error occurs.
|
||
|
|
func (_c *BatchImageItemCreateBulk) SaveX(ctx context.Context) []*BatchImageItem {
|
||
|
|
v, err := _c.Save(ctx)
|
||
|
|
if err != nil {
|
||
|
|
panic(err)
|
||
|
|
}
|
||
|
|
return v
|
||
|
|
}
|
||
|
|
|
||
|
|
// Exec executes the query.
|
||
|
|
func (_c *BatchImageItemCreateBulk) Exec(ctx context.Context) error {
|
||
|
|
_, err := _c.Save(ctx)
|
||
|
|
return err
|
||
|
|
}
|
||
|
|
|
||
|
|
// ExecX is like Exec, but panics if an error occurs.
|
||
|
|
func (_c *BatchImageItemCreateBulk) ExecX(ctx context.Context) {
|
||
|
|
if err := _c.Exec(ctx); err != nil {
|
||
|
|
panic(err)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
|
||
|
|
// of the `INSERT` statement. For example:
|
||
|
|
//
|
||
|
|
// client.BatchImageItem.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.BatchImageItemUpsert) {
|
||
|
|
// SetJobID(v+v).
|
||
|
|
// }).
|
||
|
|
// Exec(ctx)
|
||
|
|
func (_c *BatchImageItemCreateBulk) OnConflict(opts ...sql.ConflictOption) *BatchImageItemUpsertBulk {
|
||
|
|
_c.conflict = opts
|
||
|
|
return &BatchImageItemUpsertBulk{
|
||
|
|
create: _c,
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
// OnConflictColumns calls `OnConflict` and configures the columns
|
||
|
|
// as conflict target. Using this option is equivalent to using:
|
||
|
|
//
|
||
|
|
// client.BatchImageItem.Create().
|
||
|
|
// OnConflict(sql.ConflictColumns(columns...)).
|
||
|
|
// Exec(ctx)
|
||
|
|
func (_c *BatchImageItemCreateBulk) OnConflictColumns(columns ...string) *BatchImageItemUpsertBulk {
|
||
|
|
_c.conflict = append(_c.conflict, sql.ConflictColumns(columns...))
|
||
|
|
return &BatchImageItemUpsertBulk{
|
||
|
|
create: _c,
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
// BatchImageItemUpsertBulk is the builder for "upsert"-ing
|
||
|
|
// a bulk of BatchImageItem nodes.
|
||
|
|
type BatchImageItemUpsertBulk struct {
|
||
|
|
create *BatchImageItemCreateBulk
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdateNewValues updates the mutable fields using the new values that
|
||
|
|
// were set on create. Using this option is equivalent to using:
|
||
|
|
//
|
||
|
|
// client.BatchImageItem.Create().
|
||
|
|
// OnConflict(
|
||
|
|
// sql.ResolveWithNewValues(),
|
||
|
|
// ).
|
||
|
|
// Exec(ctx)
|
||
|
|
func (u *BatchImageItemUpsertBulk) UpdateNewValues() *BatchImageItemUpsertBulk {
|
||
|
|
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.CreatedAt(); exists {
|
||
|
|
s.SetIgnore(batchimageitem.FieldCreatedAt)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}))
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// Ignore sets each column to itself in case of conflict.
|
||
|
|
// Using this option is equivalent to using:
|
||
|
|
//
|
||
|
|
// client.BatchImageItem.Create().
|
||
|
|
// OnConflict(sql.ResolveWithIgnore()).
|
||
|
|
// Exec(ctx)
|
||
|
|
func (u *BatchImageItemUpsertBulk) Ignore() *BatchImageItemUpsertBulk {
|
||
|
|
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 *BatchImageItemUpsertBulk) DoNothing() *BatchImageItemUpsertBulk {
|
||
|
|
u.create.conflict = append(u.create.conflict, sql.DoNothing())
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// Update allows overriding fields `UPDATE` values. See the BatchImageItemCreateBulk.OnConflict
|
||
|
|
// documentation for more info.
|
||
|
|
func (u *BatchImageItemUpsertBulk) Update(set func(*BatchImageItemUpsert)) *BatchImageItemUpsertBulk {
|
||
|
|
u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
|
||
|
|
set(&BatchImageItemUpsert{UpdateSet: update})
|
||
|
|
}))
|
||
|
|
return u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetJobID sets the "job_id" field.
|
||
|
|
func (u *BatchImageItemUpsertBulk) SetJobID(v string) *BatchImageItemUpsertBulk {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.SetJobID(v)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdateJobID sets the "job_id" field to the value that was provided on create.
|
||
|
|
func (u *BatchImageItemUpsertBulk) UpdateJobID() *BatchImageItemUpsertBulk {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.UpdateJobID()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetCustomID sets the "custom_id" field.
|
||
|
|
func (u *BatchImageItemUpsertBulk) SetCustomID(v string) *BatchImageItemUpsertBulk {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.SetCustomID(v)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdateCustomID sets the "custom_id" field to the value that was provided on create.
|
||
|
|
func (u *BatchImageItemUpsertBulk) UpdateCustomID() *BatchImageItemUpsertBulk {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.UpdateCustomID()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetStatus sets the "status" field.
|
||
|
|
func (u *BatchImageItemUpsertBulk) SetStatus(v string) *BatchImageItemUpsertBulk {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.SetStatus(v)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdateStatus sets the "status" field to the value that was provided on create.
|
||
|
|
func (u *BatchImageItemUpsertBulk) UpdateStatus() *BatchImageItemUpsertBulk {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.UpdateStatus()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetRequestHash sets the "request_hash" field.
|
||
|
|
func (u *BatchImageItemUpsertBulk) SetRequestHash(v string) *BatchImageItemUpsertBulk {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.SetRequestHash(v)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdateRequestHash sets the "request_hash" field to the value that was provided on create.
|
||
|
|
func (u *BatchImageItemUpsertBulk) UpdateRequestHash() *BatchImageItemUpsertBulk {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.UpdateRequestHash()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearRequestHash clears the value of the "request_hash" field.
|
||
|
|
func (u *BatchImageItemUpsertBulk) ClearRequestHash() *BatchImageItemUpsertBulk {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.ClearRequestHash()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetPromptPreview sets the "prompt_preview" field.
|
||
|
|
func (u *BatchImageItemUpsertBulk) SetPromptPreview(v string) *BatchImageItemUpsertBulk {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.SetPromptPreview(v)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdatePromptPreview sets the "prompt_preview" field to the value that was provided on create.
|
||
|
|
func (u *BatchImageItemUpsertBulk) UpdatePromptPreview() *BatchImageItemUpsertBulk {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.UpdatePromptPreview()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearPromptPreview clears the value of the "prompt_preview" field.
|
||
|
|
func (u *BatchImageItemUpsertBulk) ClearPromptPreview() *BatchImageItemUpsertBulk {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.ClearPromptPreview()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetProviderSourceObject sets the "provider_source_object" field.
|
||
|
|
func (u *BatchImageItemUpsertBulk) SetProviderSourceObject(v string) *BatchImageItemUpsertBulk {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.SetProviderSourceObject(v)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdateProviderSourceObject sets the "provider_source_object" field to the value that was provided on create.
|
||
|
|
func (u *BatchImageItemUpsertBulk) UpdateProviderSourceObject() *BatchImageItemUpsertBulk {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.UpdateProviderSourceObject()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearProviderSourceObject clears the value of the "provider_source_object" field.
|
||
|
|
func (u *BatchImageItemUpsertBulk) ClearProviderSourceObject() *BatchImageItemUpsertBulk {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.ClearProviderSourceObject()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetSourceLineNumber sets the "source_line_number" field.
|
||
|
|
func (u *BatchImageItemUpsertBulk) SetSourceLineNumber(v int) *BatchImageItemUpsertBulk {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.SetSourceLineNumber(v)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// AddSourceLineNumber adds v to the "source_line_number" field.
|
||
|
|
func (u *BatchImageItemUpsertBulk) AddSourceLineNumber(v int) *BatchImageItemUpsertBulk {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.AddSourceLineNumber(v)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdateSourceLineNumber sets the "source_line_number" field to the value that was provided on create.
|
||
|
|
func (u *BatchImageItemUpsertBulk) UpdateSourceLineNumber() *BatchImageItemUpsertBulk {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.UpdateSourceLineNumber()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearSourceLineNumber clears the value of the "source_line_number" field.
|
||
|
|
func (u *BatchImageItemUpsertBulk) ClearSourceLineNumber() *BatchImageItemUpsertBulk {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.ClearSourceLineNumber()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetSourceByteOffset sets the "source_byte_offset" field.
|
||
|
|
func (u *BatchImageItemUpsertBulk) SetSourceByteOffset(v int64) *BatchImageItemUpsertBulk {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.SetSourceByteOffset(v)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// AddSourceByteOffset adds v to the "source_byte_offset" field.
|
||
|
|
func (u *BatchImageItemUpsertBulk) AddSourceByteOffset(v int64) *BatchImageItemUpsertBulk {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.AddSourceByteOffset(v)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdateSourceByteOffset sets the "source_byte_offset" field to the value that was provided on create.
|
||
|
|
func (u *BatchImageItemUpsertBulk) UpdateSourceByteOffset() *BatchImageItemUpsertBulk {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.UpdateSourceByteOffset()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearSourceByteOffset clears the value of the "source_byte_offset" field.
|
||
|
|
func (u *BatchImageItemUpsertBulk) ClearSourceByteOffset() *BatchImageItemUpsertBulk {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.ClearSourceByteOffset()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetSourceByteLength sets the "source_byte_length" field.
|
||
|
|
func (u *BatchImageItemUpsertBulk) SetSourceByteLength(v int64) *BatchImageItemUpsertBulk {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.SetSourceByteLength(v)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// AddSourceByteLength adds v to the "source_byte_length" field.
|
||
|
|
func (u *BatchImageItemUpsertBulk) AddSourceByteLength(v int64) *BatchImageItemUpsertBulk {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.AddSourceByteLength(v)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdateSourceByteLength sets the "source_byte_length" field to the value that was provided on create.
|
||
|
|
func (u *BatchImageItemUpsertBulk) UpdateSourceByteLength() *BatchImageItemUpsertBulk {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.UpdateSourceByteLength()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearSourceByteLength clears the value of the "source_byte_length" field.
|
||
|
|
func (u *BatchImageItemUpsertBulk) ClearSourceByteLength() *BatchImageItemUpsertBulk {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.ClearSourceByteLength()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetMimeType sets the "mime_type" field.
|
||
|
|
func (u *BatchImageItemUpsertBulk) SetMimeType(v string) *BatchImageItemUpsertBulk {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.SetMimeType(v)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdateMimeType sets the "mime_type" field to the value that was provided on create.
|
||
|
|
func (u *BatchImageItemUpsertBulk) UpdateMimeType() *BatchImageItemUpsertBulk {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.UpdateMimeType()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearMimeType clears the value of the "mime_type" field.
|
||
|
|
func (u *BatchImageItemUpsertBulk) ClearMimeType() *BatchImageItemUpsertBulk {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.ClearMimeType()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetFileExtension sets the "file_extension" field.
|
||
|
|
func (u *BatchImageItemUpsertBulk) SetFileExtension(v string) *BatchImageItemUpsertBulk {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.SetFileExtension(v)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdateFileExtension sets the "file_extension" field to the value that was provided on create.
|
||
|
|
func (u *BatchImageItemUpsertBulk) UpdateFileExtension() *BatchImageItemUpsertBulk {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.UpdateFileExtension()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearFileExtension clears the value of the "file_extension" field.
|
||
|
|
func (u *BatchImageItemUpsertBulk) ClearFileExtension() *BatchImageItemUpsertBulk {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.ClearFileExtension()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetImageCount sets the "image_count" field.
|
||
|
|
func (u *BatchImageItemUpsertBulk) SetImageCount(v int) *BatchImageItemUpsertBulk {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.SetImageCount(v)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// AddImageCount adds v to the "image_count" field.
|
||
|
|
func (u *BatchImageItemUpsertBulk) AddImageCount(v int) *BatchImageItemUpsertBulk {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.AddImageCount(v)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdateImageCount sets the "image_count" field to the value that was provided on create.
|
||
|
|
func (u *BatchImageItemUpsertBulk) UpdateImageCount() *BatchImageItemUpsertBulk {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.UpdateImageCount()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetErrorCode sets the "error_code" field.
|
||
|
|
func (u *BatchImageItemUpsertBulk) SetErrorCode(v string) *BatchImageItemUpsertBulk {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.SetErrorCode(v)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdateErrorCode sets the "error_code" field to the value that was provided on create.
|
||
|
|
func (u *BatchImageItemUpsertBulk) UpdateErrorCode() *BatchImageItemUpsertBulk {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.UpdateErrorCode()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearErrorCode clears the value of the "error_code" field.
|
||
|
|
func (u *BatchImageItemUpsertBulk) ClearErrorCode() *BatchImageItemUpsertBulk {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.ClearErrorCode()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetErrorMessage sets the "error_message" field.
|
||
|
|
func (u *BatchImageItemUpsertBulk) SetErrorMessage(v string) *BatchImageItemUpsertBulk {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.SetErrorMessage(v)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdateErrorMessage sets the "error_message" field to the value that was provided on create.
|
||
|
|
func (u *BatchImageItemUpsertBulk) UpdateErrorMessage() *BatchImageItemUpsertBulk {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.UpdateErrorMessage()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearErrorMessage clears the value of the "error_message" field.
|
||
|
|
func (u *BatchImageItemUpsertBulk) ClearErrorMessage() *BatchImageItemUpsertBulk {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.ClearErrorMessage()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetBilledAmount sets the "billed_amount" field.
|
||
|
|
func (u *BatchImageItemUpsertBulk) SetBilledAmount(v float64) *BatchImageItemUpsertBulk {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.SetBilledAmount(v)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// AddBilledAmount adds v to the "billed_amount" field.
|
||
|
|
func (u *BatchImageItemUpsertBulk) AddBilledAmount(v float64) *BatchImageItemUpsertBulk {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.AddBilledAmount(v)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdateBilledAmount sets the "billed_amount" field to the value that was provided on create.
|
||
|
|
func (u *BatchImageItemUpsertBulk) UpdateBilledAmount() *BatchImageItemUpsertBulk {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.UpdateBilledAmount()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearBilledAmount clears the value of the "billed_amount" field.
|
||
|
|
func (u *BatchImageItemUpsertBulk) ClearBilledAmount() *BatchImageItemUpsertBulk {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.ClearBilledAmount()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetIndexedAt sets the "indexed_at" field.
|
||
|
|
func (u *BatchImageItemUpsertBulk) SetIndexedAt(v time.Time) *BatchImageItemUpsertBulk {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.SetIndexedAt(v)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdateIndexedAt sets the "indexed_at" field to the value that was provided on create.
|
||
|
|
func (u *BatchImageItemUpsertBulk) UpdateIndexedAt() *BatchImageItemUpsertBulk {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.UpdateIndexedAt()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearIndexedAt clears the value of the "indexed_at" field.
|
||
|
|
func (u *BatchImageItemUpsertBulk) ClearIndexedAt() *BatchImageItemUpsertBulk {
|
||
|
|
return u.Update(func(s *BatchImageItemUpsert) {
|
||
|
|
s.ClearIndexedAt()
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
// Exec executes the query.
|
||
|
|
func (u *BatchImageItemUpsertBulk) 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 BatchImageItemCreateBulk instead", i)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
if len(u.create.conflict) == 0 {
|
||
|
|
return errors.New("ent: missing options for BatchImageItemCreateBulk.OnConflict")
|
||
|
|
}
|
||
|
|
return u.create.Exec(ctx)
|
||
|
|
}
|
||
|
|
|
||
|
|
// ExecX is like Exec, but panics if an error occurs.
|
||
|
|
func (u *BatchImageItemUpsertBulk) ExecX(ctx context.Context) {
|
||
|
|
if err := u.create.Exec(ctx); err != nil {
|
||
|
|
panic(err)
|
||
|
|
}
|
||
|
|
}
|