mirror of
https://github.com/chaitin/MonkeyCode.git
synced 2026-11-30 08:37:12 +08:00
1307 lines
38 KiB
Go
1307 lines
38 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package db
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"fmt"
|
|
"time"
|
|
|
|
"entgo.io/ent/dialect"
|
|
"entgo.io/ent/dialect/sql"
|
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
|
"entgo.io/ent/schema/field"
|
|
"github.com/chaitin/MonkeyCode/backend/db/gittask"
|
|
"github.com/chaitin/MonkeyCode/backend/db/task"
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
// GitTaskCreate is the builder for creating a GitTask entity.
|
|
type GitTaskCreate struct {
|
|
config
|
|
mutation *GitTaskMutation
|
|
hooks []Hook
|
|
conflict []sql.ConflictOption
|
|
}
|
|
|
|
// SetTaskID sets the "task_id" field.
|
|
func (_c *GitTaskCreate) SetTaskID(v uuid.UUID) *GitTaskCreate {
|
|
_c.mutation.SetTaskID(v)
|
|
return _c
|
|
}
|
|
|
|
// SetRepoID sets the "repo_id" field.
|
|
func (_c *GitTaskCreate) SetRepoID(v uuid.UUID) *GitTaskCreate {
|
|
_c.mutation.SetRepoID(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableRepoID sets the "repo_id" field if the given value is not nil.
|
|
func (_c *GitTaskCreate) SetNillableRepoID(v *uuid.UUID) *GitTaskCreate {
|
|
if v != nil {
|
|
_c.SetRepoID(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetSubjectType sets the "subject_type" field.
|
|
func (_c *GitTaskCreate) SetSubjectType(v string) *GitTaskCreate {
|
|
_c.mutation.SetSubjectType(v)
|
|
return _c
|
|
}
|
|
|
|
// SetSubjectID sets the "subject_id" field.
|
|
func (_c *GitTaskCreate) SetSubjectID(v string) *GitTaskCreate {
|
|
_c.mutation.SetSubjectID(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableSubjectID sets the "subject_id" field if the given value is not nil.
|
|
func (_c *GitTaskCreate) SetNillableSubjectID(v *string) *GitTaskCreate {
|
|
if v != nil {
|
|
_c.SetSubjectID(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetSubjectNumber sets the "subject_number" field.
|
|
func (_c *GitTaskCreate) SetSubjectNumber(v int) *GitTaskCreate {
|
|
_c.mutation.SetSubjectNumber(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableSubjectNumber sets the "subject_number" field if the given value is not nil.
|
|
func (_c *GitTaskCreate) SetNillableSubjectNumber(v *int) *GitTaskCreate {
|
|
if v != nil {
|
|
_c.SetSubjectNumber(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetSubjectURL sets the "subject_url" field.
|
|
func (_c *GitTaskCreate) SetSubjectURL(v string) *GitTaskCreate {
|
|
_c.mutation.SetSubjectURL(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableSubjectURL sets the "subject_url" field if the given value is not nil.
|
|
func (_c *GitTaskCreate) SetNillableSubjectURL(v *string) *GitTaskCreate {
|
|
if v != nil {
|
|
_c.SetSubjectURL(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetSubjectTitle sets the "subject_title" field.
|
|
func (_c *GitTaskCreate) SetSubjectTitle(v string) *GitTaskCreate {
|
|
_c.mutation.SetSubjectTitle(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableSubjectTitle sets the "subject_title" field if the given value is not nil.
|
|
func (_c *GitTaskCreate) SetNillableSubjectTitle(v *string) *GitTaskCreate {
|
|
if v != nil {
|
|
_c.SetSubjectTitle(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetPromptID sets the "prompt_id" field.
|
|
func (_c *GitTaskCreate) SetPromptID(v string) *GitTaskCreate {
|
|
_c.mutation.SetPromptID(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillablePromptID sets the "prompt_id" field if the given value is not nil.
|
|
func (_c *GitTaskCreate) SetNillablePromptID(v *string) *GitTaskCreate {
|
|
if v != nil {
|
|
_c.SetPromptID(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetShowURL sets the "show_url" field.
|
|
func (_c *GitTaskCreate) SetShowURL(v string) *GitTaskCreate {
|
|
_c.mutation.SetShowURL(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableShowURL sets the "show_url" field if the given value is not nil.
|
|
func (_c *GitTaskCreate) SetNillableShowURL(v *string) *GitTaskCreate {
|
|
if v != nil {
|
|
_c.SetShowURL(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetGithubInstallationID sets the "github_installation_id" field.
|
|
func (_c *GitTaskCreate) SetGithubInstallationID(v int64) *GitTaskCreate {
|
|
_c.mutation.SetGithubInstallationID(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableGithubInstallationID sets the "github_installation_id" field if the given value is not nil.
|
|
func (_c *GitTaskCreate) SetNillableGithubInstallationID(v *int64) *GitTaskCreate {
|
|
if v != nil {
|
|
_c.SetGithubInstallationID(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetCreatedAt sets the "created_at" field.
|
|
func (_c *GitTaskCreate) SetCreatedAt(v time.Time) *GitTaskCreate {
|
|
_c.mutation.SetCreatedAt(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
|
|
func (_c *GitTaskCreate) SetNillableCreatedAt(v *time.Time) *GitTaskCreate {
|
|
if v != nil {
|
|
_c.SetCreatedAt(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetID sets the "id" field.
|
|
func (_c *GitTaskCreate) SetID(v uuid.UUID) *GitTaskCreate {
|
|
_c.mutation.SetID(v)
|
|
return _c
|
|
}
|
|
|
|
// SetTask sets the "task" edge to the Task entity.
|
|
func (_c *GitTaskCreate) SetTask(v *Task) *GitTaskCreate {
|
|
return _c.SetTaskID(v.ID)
|
|
}
|
|
|
|
// Mutation returns the GitTaskMutation object of the builder.
|
|
func (_c *GitTaskCreate) Mutation() *GitTaskMutation {
|
|
return _c.mutation
|
|
}
|
|
|
|
// Save creates the GitTask in the database.
|
|
func (_c *GitTaskCreate) Save(ctx context.Context) (*GitTask, error) {
|
|
_c.defaults()
|
|
return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
|
|
}
|
|
|
|
// SaveX calls Save and panics if Save returns an error.
|
|
func (_c *GitTaskCreate) SaveX(ctx context.Context) *GitTask {
|
|
v, err := _c.Save(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return v
|
|
}
|
|
|
|
// Exec executes the query.
|
|
func (_c *GitTaskCreate) Exec(ctx context.Context) error {
|
|
_, err := _c.Save(ctx)
|
|
return err
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (_c *GitTaskCreate) 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 *GitTaskCreate) defaults() {
|
|
if _, ok := _c.mutation.CreatedAt(); !ok {
|
|
v := gittask.DefaultCreatedAt()
|
|
_c.mutation.SetCreatedAt(v)
|
|
}
|
|
}
|
|
|
|
// check runs all checks and user-defined validators on the builder.
|
|
func (_c *GitTaskCreate) check() error {
|
|
if _, ok := _c.mutation.TaskID(); !ok {
|
|
return &ValidationError{Name: "task_id", err: errors.New(`db: missing required field "GitTask.task_id"`)}
|
|
}
|
|
if _, ok := _c.mutation.SubjectType(); !ok {
|
|
return &ValidationError{Name: "subject_type", err: errors.New(`db: missing required field "GitTask.subject_type"`)}
|
|
}
|
|
if v, ok := _c.mutation.SubjectType(); ok {
|
|
if err := gittask.SubjectTypeValidator(v); err != nil {
|
|
return &ValidationError{Name: "subject_type", err: fmt.Errorf(`db: validator failed for field "GitTask.subject_type": %w`, err)}
|
|
}
|
|
}
|
|
if _, ok := _c.mutation.CreatedAt(); !ok {
|
|
return &ValidationError{Name: "created_at", err: errors.New(`db: missing required field "GitTask.created_at"`)}
|
|
}
|
|
if len(_c.mutation.TaskIDs()) == 0 {
|
|
return &ValidationError{Name: "task", err: errors.New(`db: missing required edge "GitTask.task"`)}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (_c *GitTaskCreate) sqlSave(ctx context.Context) (*GitTask, 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
|
|
}
|
|
if _spec.ID.Value != nil {
|
|
if id, ok := _spec.ID.Value.(*uuid.UUID); ok {
|
|
_node.ID = *id
|
|
} else if err := _node.ID.Scan(_spec.ID.Value); err != nil {
|
|
return nil, err
|
|
}
|
|
}
|
|
_c.mutation.id = &_node.ID
|
|
_c.mutation.done = true
|
|
return _node, nil
|
|
}
|
|
|
|
func (_c *GitTaskCreate) createSpec() (*GitTask, *sqlgraph.CreateSpec) {
|
|
var (
|
|
_node = &GitTask{config: _c.config}
|
|
_spec = sqlgraph.NewCreateSpec(gittask.Table, sqlgraph.NewFieldSpec(gittask.FieldID, field.TypeUUID))
|
|
)
|
|
_spec.OnConflict = _c.conflict
|
|
if id, ok := _c.mutation.ID(); ok {
|
|
_node.ID = id
|
|
_spec.ID.Value = &id
|
|
}
|
|
if value, ok := _c.mutation.RepoID(); ok {
|
|
_spec.SetField(gittask.FieldRepoID, field.TypeUUID, value)
|
|
_node.RepoID = value
|
|
}
|
|
if value, ok := _c.mutation.SubjectType(); ok {
|
|
_spec.SetField(gittask.FieldSubjectType, field.TypeString, value)
|
|
_node.SubjectType = value
|
|
}
|
|
if value, ok := _c.mutation.SubjectID(); ok {
|
|
_spec.SetField(gittask.FieldSubjectID, field.TypeString, value)
|
|
_node.SubjectID = value
|
|
}
|
|
if value, ok := _c.mutation.SubjectNumber(); ok {
|
|
_spec.SetField(gittask.FieldSubjectNumber, field.TypeInt, value)
|
|
_node.SubjectNumber = value
|
|
}
|
|
if value, ok := _c.mutation.SubjectURL(); ok {
|
|
_spec.SetField(gittask.FieldSubjectURL, field.TypeString, value)
|
|
_node.SubjectURL = value
|
|
}
|
|
if value, ok := _c.mutation.SubjectTitle(); ok {
|
|
_spec.SetField(gittask.FieldSubjectTitle, field.TypeString, value)
|
|
_node.SubjectTitle = value
|
|
}
|
|
if value, ok := _c.mutation.PromptID(); ok {
|
|
_spec.SetField(gittask.FieldPromptID, field.TypeString, value)
|
|
_node.PromptID = value
|
|
}
|
|
if value, ok := _c.mutation.ShowURL(); ok {
|
|
_spec.SetField(gittask.FieldShowURL, field.TypeString, value)
|
|
_node.ShowURL = value
|
|
}
|
|
if value, ok := _c.mutation.GithubInstallationID(); ok {
|
|
_spec.SetField(gittask.FieldGithubInstallationID, field.TypeInt64, value)
|
|
_node.GithubInstallationID = value
|
|
}
|
|
if value, ok := _c.mutation.CreatedAt(); ok {
|
|
_spec.SetField(gittask.FieldCreatedAt, field.TypeTime, value)
|
|
_node.CreatedAt = value
|
|
}
|
|
if nodes := _c.mutation.TaskIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.O2O,
|
|
Inverse: true,
|
|
Table: gittask.TaskTable,
|
|
Columns: []string{gittask.TaskColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(task.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
for _, k := range nodes {
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
}
|
|
_node.TaskID = nodes[0]
|
|
_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.GitTask.Create().
|
|
// SetTaskID(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.GitTaskUpsert) {
|
|
// SetTaskID(v+v).
|
|
// }).
|
|
// Exec(ctx)
|
|
func (_c *GitTaskCreate) OnConflict(opts ...sql.ConflictOption) *GitTaskUpsertOne {
|
|
_c.conflict = opts
|
|
return &GitTaskUpsertOne{
|
|
create: _c,
|
|
}
|
|
}
|
|
|
|
// OnConflictColumns calls `OnConflict` and configures the columns
|
|
// as conflict target. Using this option is equivalent to using:
|
|
//
|
|
// client.GitTask.Create().
|
|
// OnConflict(sql.ConflictColumns(columns...)).
|
|
// Exec(ctx)
|
|
func (_c *GitTaskCreate) OnConflictColumns(columns ...string) *GitTaskUpsertOne {
|
|
_c.conflict = append(_c.conflict, sql.ConflictColumns(columns...))
|
|
return &GitTaskUpsertOne{
|
|
create: _c,
|
|
}
|
|
}
|
|
|
|
type (
|
|
// GitTaskUpsertOne is the builder for "upsert"-ing
|
|
// one GitTask node.
|
|
GitTaskUpsertOne struct {
|
|
create *GitTaskCreate
|
|
}
|
|
|
|
// GitTaskUpsert is the "OnConflict" setter.
|
|
GitTaskUpsert struct {
|
|
*sql.UpdateSet
|
|
}
|
|
)
|
|
|
|
// SetTaskID sets the "task_id" field.
|
|
func (u *GitTaskUpsert) SetTaskID(v uuid.UUID) *GitTaskUpsert {
|
|
u.Set(gittask.FieldTaskID, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateTaskID sets the "task_id" field to the value that was provided on create.
|
|
func (u *GitTaskUpsert) UpdateTaskID() *GitTaskUpsert {
|
|
u.SetExcluded(gittask.FieldTaskID)
|
|
return u
|
|
}
|
|
|
|
// SetRepoID sets the "repo_id" field.
|
|
func (u *GitTaskUpsert) SetRepoID(v uuid.UUID) *GitTaskUpsert {
|
|
u.Set(gittask.FieldRepoID, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateRepoID sets the "repo_id" field to the value that was provided on create.
|
|
func (u *GitTaskUpsert) UpdateRepoID() *GitTaskUpsert {
|
|
u.SetExcluded(gittask.FieldRepoID)
|
|
return u
|
|
}
|
|
|
|
// ClearRepoID clears the value of the "repo_id" field.
|
|
func (u *GitTaskUpsert) ClearRepoID() *GitTaskUpsert {
|
|
u.SetNull(gittask.FieldRepoID)
|
|
return u
|
|
}
|
|
|
|
// SetSubjectType sets the "subject_type" field.
|
|
func (u *GitTaskUpsert) SetSubjectType(v string) *GitTaskUpsert {
|
|
u.Set(gittask.FieldSubjectType, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateSubjectType sets the "subject_type" field to the value that was provided on create.
|
|
func (u *GitTaskUpsert) UpdateSubjectType() *GitTaskUpsert {
|
|
u.SetExcluded(gittask.FieldSubjectType)
|
|
return u
|
|
}
|
|
|
|
// SetSubjectID sets the "subject_id" field.
|
|
func (u *GitTaskUpsert) SetSubjectID(v string) *GitTaskUpsert {
|
|
u.Set(gittask.FieldSubjectID, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateSubjectID sets the "subject_id" field to the value that was provided on create.
|
|
func (u *GitTaskUpsert) UpdateSubjectID() *GitTaskUpsert {
|
|
u.SetExcluded(gittask.FieldSubjectID)
|
|
return u
|
|
}
|
|
|
|
// ClearSubjectID clears the value of the "subject_id" field.
|
|
func (u *GitTaskUpsert) ClearSubjectID() *GitTaskUpsert {
|
|
u.SetNull(gittask.FieldSubjectID)
|
|
return u
|
|
}
|
|
|
|
// SetSubjectNumber sets the "subject_number" field.
|
|
func (u *GitTaskUpsert) SetSubjectNumber(v int) *GitTaskUpsert {
|
|
u.Set(gittask.FieldSubjectNumber, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateSubjectNumber sets the "subject_number" field to the value that was provided on create.
|
|
func (u *GitTaskUpsert) UpdateSubjectNumber() *GitTaskUpsert {
|
|
u.SetExcluded(gittask.FieldSubjectNumber)
|
|
return u
|
|
}
|
|
|
|
// AddSubjectNumber adds v to the "subject_number" field.
|
|
func (u *GitTaskUpsert) AddSubjectNumber(v int) *GitTaskUpsert {
|
|
u.Add(gittask.FieldSubjectNumber, v)
|
|
return u
|
|
}
|
|
|
|
// ClearSubjectNumber clears the value of the "subject_number" field.
|
|
func (u *GitTaskUpsert) ClearSubjectNumber() *GitTaskUpsert {
|
|
u.SetNull(gittask.FieldSubjectNumber)
|
|
return u
|
|
}
|
|
|
|
// SetSubjectURL sets the "subject_url" field.
|
|
func (u *GitTaskUpsert) SetSubjectURL(v string) *GitTaskUpsert {
|
|
u.Set(gittask.FieldSubjectURL, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateSubjectURL sets the "subject_url" field to the value that was provided on create.
|
|
func (u *GitTaskUpsert) UpdateSubjectURL() *GitTaskUpsert {
|
|
u.SetExcluded(gittask.FieldSubjectURL)
|
|
return u
|
|
}
|
|
|
|
// ClearSubjectURL clears the value of the "subject_url" field.
|
|
func (u *GitTaskUpsert) ClearSubjectURL() *GitTaskUpsert {
|
|
u.SetNull(gittask.FieldSubjectURL)
|
|
return u
|
|
}
|
|
|
|
// SetSubjectTitle sets the "subject_title" field.
|
|
func (u *GitTaskUpsert) SetSubjectTitle(v string) *GitTaskUpsert {
|
|
u.Set(gittask.FieldSubjectTitle, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateSubjectTitle sets the "subject_title" field to the value that was provided on create.
|
|
func (u *GitTaskUpsert) UpdateSubjectTitle() *GitTaskUpsert {
|
|
u.SetExcluded(gittask.FieldSubjectTitle)
|
|
return u
|
|
}
|
|
|
|
// ClearSubjectTitle clears the value of the "subject_title" field.
|
|
func (u *GitTaskUpsert) ClearSubjectTitle() *GitTaskUpsert {
|
|
u.SetNull(gittask.FieldSubjectTitle)
|
|
return u
|
|
}
|
|
|
|
// SetPromptID sets the "prompt_id" field.
|
|
func (u *GitTaskUpsert) SetPromptID(v string) *GitTaskUpsert {
|
|
u.Set(gittask.FieldPromptID, v)
|
|
return u
|
|
}
|
|
|
|
// UpdatePromptID sets the "prompt_id" field to the value that was provided on create.
|
|
func (u *GitTaskUpsert) UpdatePromptID() *GitTaskUpsert {
|
|
u.SetExcluded(gittask.FieldPromptID)
|
|
return u
|
|
}
|
|
|
|
// ClearPromptID clears the value of the "prompt_id" field.
|
|
func (u *GitTaskUpsert) ClearPromptID() *GitTaskUpsert {
|
|
u.SetNull(gittask.FieldPromptID)
|
|
return u
|
|
}
|
|
|
|
// SetShowURL sets the "show_url" field.
|
|
func (u *GitTaskUpsert) SetShowURL(v string) *GitTaskUpsert {
|
|
u.Set(gittask.FieldShowURL, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateShowURL sets the "show_url" field to the value that was provided on create.
|
|
func (u *GitTaskUpsert) UpdateShowURL() *GitTaskUpsert {
|
|
u.SetExcluded(gittask.FieldShowURL)
|
|
return u
|
|
}
|
|
|
|
// ClearShowURL clears the value of the "show_url" field.
|
|
func (u *GitTaskUpsert) ClearShowURL() *GitTaskUpsert {
|
|
u.SetNull(gittask.FieldShowURL)
|
|
return u
|
|
}
|
|
|
|
// SetGithubInstallationID sets the "github_installation_id" field.
|
|
func (u *GitTaskUpsert) SetGithubInstallationID(v int64) *GitTaskUpsert {
|
|
u.Set(gittask.FieldGithubInstallationID, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateGithubInstallationID sets the "github_installation_id" field to the value that was provided on create.
|
|
func (u *GitTaskUpsert) UpdateGithubInstallationID() *GitTaskUpsert {
|
|
u.SetExcluded(gittask.FieldGithubInstallationID)
|
|
return u
|
|
}
|
|
|
|
// AddGithubInstallationID adds v to the "github_installation_id" field.
|
|
func (u *GitTaskUpsert) AddGithubInstallationID(v int64) *GitTaskUpsert {
|
|
u.Add(gittask.FieldGithubInstallationID, v)
|
|
return u
|
|
}
|
|
|
|
// ClearGithubInstallationID clears the value of the "github_installation_id" field.
|
|
func (u *GitTaskUpsert) ClearGithubInstallationID() *GitTaskUpsert {
|
|
u.SetNull(gittask.FieldGithubInstallationID)
|
|
return u
|
|
}
|
|
|
|
// SetCreatedAt sets the "created_at" field.
|
|
func (u *GitTaskUpsert) SetCreatedAt(v time.Time) *GitTaskUpsert {
|
|
u.Set(gittask.FieldCreatedAt, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateCreatedAt sets the "created_at" field to the value that was provided on create.
|
|
func (u *GitTaskUpsert) UpdateCreatedAt() *GitTaskUpsert {
|
|
u.SetExcluded(gittask.FieldCreatedAt)
|
|
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.GitTask.Create().
|
|
// OnConflict(
|
|
// sql.ResolveWithNewValues(),
|
|
// sql.ResolveWith(func(u *sql.UpdateSet) {
|
|
// u.SetIgnore(gittask.FieldID)
|
|
// }),
|
|
// ).
|
|
// Exec(ctx)
|
|
func (u *GitTaskUpsertOne) UpdateNewValues() *GitTaskUpsertOne {
|
|
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(gittask.FieldID)
|
|
}
|
|
}))
|
|
return u
|
|
}
|
|
|
|
// Ignore sets each column to itself in case of conflict.
|
|
// Using this option is equivalent to using:
|
|
//
|
|
// client.GitTask.Create().
|
|
// OnConflict(sql.ResolveWithIgnore()).
|
|
// Exec(ctx)
|
|
func (u *GitTaskUpsertOne) Ignore() *GitTaskUpsertOne {
|
|
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 *GitTaskUpsertOne) DoNothing() *GitTaskUpsertOne {
|
|
u.create.conflict = append(u.create.conflict, sql.DoNothing())
|
|
return u
|
|
}
|
|
|
|
// Update allows overriding fields `UPDATE` values. See the GitTaskCreate.OnConflict
|
|
// documentation for more info.
|
|
func (u *GitTaskUpsertOne) Update(set func(*GitTaskUpsert)) *GitTaskUpsertOne {
|
|
u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
|
|
set(&GitTaskUpsert{UpdateSet: update})
|
|
}))
|
|
return u
|
|
}
|
|
|
|
// SetTaskID sets the "task_id" field.
|
|
func (u *GitTaskUpsertOne) SetTaskID(v uuid.UUID) *GitTaskUpsertOne {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.SetTaskID(v)
|
|
})
|
|
}
|
|
|
|
// UpdateTaskID sets the "task_id" field to the value that was provided on create.
|
|
func (u *GitTaskUpsertOne) UpdateTaskID() *GitTaskUpsertOne {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.UpdateTaskID()
|
|
})
|
|
}
|
|
|
|
// SetRepoID sets the "repo_id" field.
|
|
func (u *GitTaskUpsertOne) SetRepoID(v uuid.UUID) *GitTaskUpsertOne {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.SetRepoID(v)
|
|
})
|
|
}
|
|
|
|
// UpdateRepoID sets the "repo_id" field to the value that was provided on create.
|
|
func (u *GitTaskUpsertOne) UpdateRepoID() *GitTaskUpsertOne {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.UpdateRepoID()
|
|
})
|
|
}
|
|
|
|
// ClearRepoID clears the value of the "repo_id" field.
|
|
func (u *GitTaskUpsertOne) ClearRepoID() *GitTaskUpsertOne {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.ClearRepoID()
|
|
})
|
|
}
|
|
|
|
// SetSubjectType sets the "subject_type" field.
|
|
func (u *GitTaskUpsertOne) SetSubjectType(v string) *GitTaskUpsertOne {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.SetSubjectType(v)
|
|
})
|
|
}
|
|
|
|
// UpdateSubjectType sets the "subject_type" field to the value that was provided on create.
|
|
func (u *GitTaskUpsertOne) UpdateSubjectType() *GitTaskUpsertOne {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.UpdateSubjectType()
|
|
})
|
|
}
|
|
|
|
// SetSubjectID sets the "subject_id" field.
|
|
func (u *GitTaskUpsertOne) SetSubjectID(v string) *GitTaskUpsertOne {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.SetSubjectID(v)
|
|
})
|
|
}
|
|
|
|
// UpdateSubjectID sets the "subject_id" field to the value that was provided on create.
|
|
func (u *GitTaskUpsertOne) UpdateSubjectID() *GitTaskUpsertOne {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.UpdateSubjectID()
|
|
})
|
|
}
|
|
|
|
// ClearSubjectID clears the value of the "subject_id" field.
|
|
func (u *GitTaskUpsertOne) ClearSubjectID() *GitTaskUpsertOne {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.ClearSubjectID()
|
|
})
|
|
}
|
|
|
|
// SetSubjectNumber sets the "subject_number" field.
|
|
func (u *GitTaskUpsertOne) SetSubjectNumber(v int) *GitTaskUpsertOne {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.SetSubjectNumber(v)
|
|
})
|
|
}
|
|
|
|
// AddSubjectNumber adds v to the "subject_number" field.
|
|
func (u *GitTaskUpsertOne) AddSubjectNumber(v int) *GitTaskUpsertOne {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.AddSubjectNumber(v)
|
|
})
|
|
}
|
|
|
|
// UpdateSubjectNumber sets the "subject_number" field to the value that was provided on create.
|
|
func (u *GitTaskUpsertOne) UpdateSubjectNumber() *GitTaskUpsertOne {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.UpdateSubjectNumber()
|
|
})
|
|
}
|
|
|
|
// ClearSubjectNumber clears the value of the "subject_number" field.
|
|
func (u *GitTaskUpsertOne) ClearSubjectNumber() *GitTaskUpsertOne {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.ClearSubjectNumber()
|
|
})
|
|
}
|
|
|
|
// SetSubjectURL sets the "subject_url" field.
|
|
func (u *GitTaskUpsertOne) SetSubjectURL(v string) *GitTaskUpsertOne {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.SetSubjectURL(v)
|
|
})
|
|
}
|
|
|
|
// UpdateSubjectURL sets the "subject_url" field to the value that was provided on create.
|
|
func (u *GitTaskUpsertOne) UpdateSubjectURL() *GitTaskUpsertOne {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.UpdateSubjectURL()
|
|
})
|
|
}
|
|
|
|
// ClearSubjectURL clears the value of the "subject_url" field.
|
|
func (u *GitTaskUpsertOne) ClearSubjectURL() *GitTaskUpsertOne {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.ClearSubjectURL()
|
|
})
|
|
}
|
|
|
|
// SetSubjectTitle sets the "subject_title" field.
|
|
func (u *GitTaskUpsertOne) SetSubjectTitle(v string) *GitTaskUpsertOne {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.SetSubjectTitle(v)
|
|
})
|
|
}
|
|
|
|
// UpdateSubjectTitle sets the "subject_title" field to the value that was provided on create.
|
|
func (u *GitTaskUpsertOne) UpdateSubjectTitle() *GitTaskUpsertOne {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.UpdateSubjectTitle()
|
|
})
|
|
}
|
|
|
|
// ClearSubjectTitle clears the value of the "subject_title" field.
|
|
func (u *GitTaskUpsertOne) ClearSubjectTitle() *GitTaskUpsertOne {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.ClearSubjectTitle()
|
|
})
|
|
}
|
|
|
|
// SetPromptID sets the "prompt_id" field.
|
|
func (u *GitTaskUpsertOne) SetPromptID(v string) *GitTaskUpsertOne {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.SetPromptID(v)
|
|
})
|
|
}
|
|
|
|
// UpdatePromptID sets the "prompt_id" field to the value that was provided on create.
|
|
func (u *GitTaskUpsertOne) UpdatePromptID() *GitTaskUpsertOne {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.UpdatePromptID()
|
|
})
|
|
}
|
|
|
|
// ClearPromptID clears the value of the "prompt_id" field.
|
|
func (u *GitTaskUpsertOne) ClearPromptID() *GitTaskUpsertOne {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.ClearPromptID()
|
|
})
|
|
}
|
|
|
|
// SetShowURL sets the "show_url" field.
|
|
func (u *GitTaskUpsertOne) SetShowURL(v string) *GitTaskUpsertOne {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.SetShowURL(v)
|
|
})
|
|
}
|
|
|
|
// UpdateShowURL sets the "show_url" field to the value that was provided on create.
|
|
func (u *GitTaskUpsertOne) UpdateShowURL() *GitTaskUpsertOne {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.UpdateShowURL()
|
|
})
|
|
}
|
|
|
|
// ClearShowURL clears the value of the "show_url" field.
|
|
func (u *GitTaskUpsertOne) ClearShowURL() *GitTaskUpsertOne {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.ClearShowURL()
|
|
})
|
|
}
|
|
|
|
// SetGithubInstallationID sets the "github_installation_id" field.
|
|
func (u *GitTaskUpsertOne) SetGithubInstallationID(v int64) *GitTaskUpsertOne {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.SetGithubInstallationID(v)
|
|
})
|
|
}
|
|
|
|
// AddGithubInstallationID adds v to the "github_installation_id" field.
|
|
func (u *GitTaskUpsertOne) AddGithubInstallationID(v int64) *GitTaskUpsertOne {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.AddGithubInstallationID(v)
|
|
})
|
|
}
|
|
|
|
// UpdateGithubInstallationID sets the "github_installation_id" field to the value that was provided on create.
|
|
func (u *GitTaskUpsertOne) UpdateGithubInstallationID() *GitTaskUpsertOne {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.UpdateGithubInstallationID()
|
|
})
|
|
}
|
|
|
|
// ClearGithubInstallationID clears the value of the "github_installation_id" field.
|
|
func (u *GitTaskUpsertOne) ClearGithubInstallationID() *GitTaskUpsertOne {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.ClearGithubInstallationID()
|
|
})
|
|
}
|
|
|
|
// SetCreatedAt sets the "created_at" field.
|
|
func (u *GitTaskUpsertOne) SetCreatedAt(v time.Time) *GitTaskUpsertOne {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.SetCreatedAt(v)
|
|
})
|
|
}
|
|
|
|
// UpdateCreatedAt sets the "created_at" field to the value that was provided on create.
|
|
func (u *GitTaskUpsertOne) UpdateCreatedAt() *GitTaskUpsertOne {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.UpdateCreatedAt()
|
|
})
|
|
}
|
|
|
|
// Exec executes the query.
|
|
func (u *GitTaskUpsertOne) Exec(ctx context.Context) error {
|
|
if len(u.create.conflict) == 0 {
|
|
return errors.New("db: missing options for GitTaskCreate.OnConflict")
|
|
}
|
|
return u.create.Exec(ctx)
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (u *GitTaskUpsertOne) 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 *GitTaskUpsertOne) ID(ctx context.Context) (id uuid.UUID, 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("db: GitTaskUpsertOne.ID is not supported by MySQL driver. Use GitTaskUpsertOne.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 *GitTaskUpsertOne) IDX(ctx context.Context) uuid.UUID {
|
|
id, err := u.ID(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return id
|
|
}
|
|
|
|
// GitTaskCreateBulk is the builder for creating many GitTask entities in bulk.
|
|
type GitTaskCreateBulk struct {
|
|
config
|
|
err error
|
|
builders []*GitTaskCreate
|
|
conflict []sql.ConflictOption
|
|
}
|
|
|
|
// Save creates the GitTask entities in the database.
|
|
func (_c *GitTaskCreateBulk) Save(ctx context.Context) ([]*GitTask, error) {
|
|
if _c.err != nil {
|
|
return nil, _c.err
|
|
}
|
|
specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
|
|
nodes := make([]*GitTask, 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.(*GitTaskMutation)
|
|
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
|
|
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 *GitTaskCreateBulk) SaveX(ctx context.Context) []*GitTask {
|
|
v, err := _c.Save(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return v
|
|
}
|
|
|
|
// Exec executes the query.
|
|
func (_c *GitTaskCreateBulk) Exec(ctx context.Context) error {
|
|
_, err := _c.Save(ctx)
|
|
return err
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (_c *GitTaskCreateBulk) 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.GitTask.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.GitTaskUpsert) {
|
|
// SetTaskID(v+v).
|
|
// }).
|
|
// Exec(ctx)
|
|
func (_c *GitTaskCreateBulk) OnConflict(opts ...sql.ConflictOption) *GitTaskUpsertBulk {
|
|
_c.conflict = opts
|
|
return &GitTaskUpsertBulk{
|
|
create: _c,
|
|
}
|
|
}
|
|
|
|
// OnConflictColumns calls `OnConflict` and configures the columns
|
|
// as conflict target. Using this option is equivalent to using:
|
|
//
|
|
// client.GitTask.Create().
|
|
// OnConflict(sql.ConflictColumns(columns...)).
|
|
// Exec(ctx)
|
|
func (_c *GitTaskCreateBulk) OnConflictColumns(columns ...string) *GitTaskUpsertBulk {
|
|
_c.conflict = append(_c.conflict, sql.ConflictColumns(columns...))
|
|
return &GitTaskUpsertBulk{
|
|
create: _c,
|
|
}
|
|
}
|
|
|
|
// GitTaskUpsertBulk is the builder for "upsert"-ing
|
|
// a bulk of GitTask nodes.
|
|
type GitTaskUpsertBulk struct {
|
|
create *GitTaskCreateBulk
|
|
}
|
|
|
|
// UpdateNewValues updates the mutable fields using the new values that
|
|
// were set on create. Using this option is equivalent to using:
|
|
//
|
|
// client.GitTask.Create().
|
|
// OnConflict(
|
|
// sql.ResolveWithNewValues(),
|
|
// sql.ResolveWith(func(u *sql.UpdateSet) {
|
|
// u.SetIgnore(gittask.FieldID)
|
|
// }),
|
|
// ).
|
|
// Exec(ctx)
|
|
func (u *GitTaskUpsertBulk) UpdateNewValues() *GitTaskUpsertBulk {
|
|
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(gittask.FieldID)
|
|
}
|
|
}
|
|
}))
|
|
return u
|
|
}
|
|
|
|
// Ignore sets each column to itself in case of conflict.
|
|
// Using this option is equivalent to using:
|
|
//
|
|
// client.GitTask.Create().
|
|
// OnConflict(sql.ResolveWithIgnore()).
|
|
// Exec(ctx)
|
|
func (u *GitTaskUpsertBulk) Ignore() *GitTaskUpsertBulk {
|
|
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 *GitTaskUpsertBulk) DoNothing() *GitTaskUpsertBulk {
|
|
u.create.conflict = append(u.create.conflict, sql.DoNothing())
|
|
return u
|
|
}
|
|
|
|
// Update allows overriding fields `UPDATE` values. See the GitTaskCreateBulk.OnConflict
|
|
// documentation for more info.
|
|
func (u *GitTaskUpsertBulk) Update(set func(*GitTaskUpsert)) *GitTaskUpsertBulk {
|
|
u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
|
|
set(&GitTaskUpsert{UpdateSet: update})
|
|
}))
|
|
return u
|
|
}
|
|
|
|
// SetTaskID sets the "task_id" field.
|
|
func (u *GitTaskUpsertBulk) SetTaskID(v uuid.UUID) *GitTaskUpsertBulk {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.SetTaskID(v)
|
|
})
|
|
}
|
|
|
|
// UpdateTaskID sets the "task_id" field to the value that was provided on create.
|
|
func (u *GitTaskUpsertBulk) UpdateTaskID() *GitTaskUpsertBulk {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.UpdateTaskID()
|
|
})
|
|
}
|
|
|
|
// SetRepoID sets the "repo_id" field.
|
|
func (u *GitTaskUpsertBulk) SetRepoID(v uuid.UUID) *GitTaskUpsertBulk {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.SetRepoID(v)
|
|
})
|
|
}
|
|
|
|
// UpdateRepoID sets the "repo_id" field to the value that was provided on create.
|
|
func (u *GitTaskUpsertBulk) UpdateRepoID() *GitTaskUpsertBulk {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.UpdateRepoID()
|
|
})
|
|
}
|
|
|
|
// ClearRepoID clears the value of the "repo_id" field.
|
|
func (u *GitTaskUpsertBulk) ClearRepoID() *GitTaskUpsertBulk {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.ClearRepoID()
|
|
})
|
|
}
|
|
|
|
// SetSubjectType sets the "subject_type" field.
|
|
func (u *GitTaskUpsertBulk) SetSubjectType(v string) *GitTaskUpsertBulk {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.SetSubjectType(v)
|
|
})
|
|
}
|
|
|
|
// UpdateSubjectType sets the "subject_type" field to the value that was provided on create.
|
|
func (u *GitTaskUpsertBulk) UpdateSubjectType() *GitTaskUpsertBulk {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.UpdateSubjectType()
|
|
})
|
|
}
|
|
|
|
// SetSubjectID sets the "subject_id" field.
|
|
func (u *GitTaskUpsertBulk) SetSubjectID(v string) *GitTaskUpsertBulk {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.SetSubjectID(v)
|
|
})
|
|
}
|
|
|
|
// UpdateSubjectID sets the "subject_id" field to the value that was provided on create.
|
|
func (u *GitTaskUpsertBulk) UpdateSubjectID() *GitTaskUpsertBulk {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.UpdateSubjectID()
|
|
})
|
|
}
|
|
|
|
// ClearSubjectID clears the value of the "subject_id" field.
|
|
func (u *GitTaskUpsertBulk) ClearSubjectID() *GitTaskUpsertBulk {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.ClearSubjectID()
|
|
})
|
|
}
|
|
|
|
// SetSubjectNumber sets the "subject_number" field.
|
|
func (u *GitTaskUpsertBulk) SetSubjectNumber(v int) *GitTaskUpsertBulk {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.SetSubjectNumber(v)
|
|
})
|
|
}
|
|
|
|
// AddSubjectNumber adds v to the "subject_number" field.
|
|
func (u *GitTaskUpsertBulk) AddSubjectNumber(v int) *GitTaskUpsertBulk {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.AddSubjectNumber(v)
|
|
})
|
|
}
|
|
|
|
// UpdateSubjectNumber sets the "subject_number" field to the value that was provided on create.
|
|
func (u *GitTaskUpsertBulk) UpdateSubjectNumber() *GitTaskUpsertBulk {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.UpdateSubjectNumber()
|
|
})
|
|
}
|
|
|
|
// ClearSubjectNumber clears the value of the "subject_number" field.
|
|
func (u *GitTaskUpsertBulk) ClearSubjectNumber() *GitTaskUpsertBulk {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.ClearSubjectNumber()
|
|
})
|
|
}
|
|
|
|
// SetSubjectURL sets the "subject_url" field.
|
|
func (u *GitTaskUpsertBulk) SetSubjectURL(v string) *GitTaskUpsertBulk {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.SetSubjectURL(v)
|
|
})
|
|
}
|
|
|
|
// UpdateSubjectURL sets the "subject_url" field to the value that was provided on create.
|
|
func (u *GitTaskUpsertBulk) UpdateSubjectURL() *GitTaskUpsertBulk {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.UpdateSubjectURL()
|
|
})
|
|
}
|
|
|
|
// ClearSubjectURL clears the value of the "subject_url" field.
|
|
func (u *GitTaskUpsertBulk) ClearSubjectURL() *GitTaskUpsertBulk {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.ClearSubjectURL()
|
|
})
|
|
}
|
|
|
|
// SetSubjectTitle sets the "subject_title" field.
|
|
func (u *GitTaskUpsertBulk) SetSubjectTitle(v string) *GitTaskUpsertBulk {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.SetSubjectTitle(v)
|
|
})
|
|
}
|
|
|
|
// UpdateSubjectTitle sets the "subject_title" field to the value that was provided on create.
|
|
func (u *GitTaskUpsertBulk) UpdateSubjectTitle() *GitTaskUpsertBulk {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.UpdateSubjectTitle()
|
|
})
|
|
}
|
|
|
|
// ClearSubjectTitle clears the value of the "subject_title" field.
|
|
func (u *GitTaskUpsertBulk) ClearSubjectTitle() *GitTaskUpsertBulk {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.ClearSubjectTitle()
|
|
})
|
|
}
|
|
|
|
// SetPromptID sets the "prompt_id" field.
|
|
func (u *GitTaskUpsertBulk) SetPromptID(v string) *GitTaskUpsertBulk {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.SetPromptID(v)
|
|
})
|
|
}
|
|
|
|
// UpdatePromptID sets the "prompt_id" field to the value that was provided on create.
|
|
func (u *GitTaskUpsertBulk) UpdatePromptID() *GitTaskUpsertBulk {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.UpdatePromptID()
|
|
})
|
|
}
|
|
|
|
// ClearPromptID clears the value of the "prompt_id" field.
|
|
func (u *GitTaskUpsertBulk) ClearPromptID() *GitTaskUpsertBulk {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.ClearPromptID()
|
|
})
|
|
}
|
|
|
|
// SetShowURL sets the "show_url" field.
|
|
func (u *GitTaskUpsertBulk) SetShowURL(v string) *GitTaskUpsertBulk {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.SetShowURL(v)
|
|
})
|
|
}
|
|
|
|
// UpdateShowURL sets the "show_url" field to the value that was provided on create.
|
|
func (u *GitTaskUpsertBulk) UpdateShowURL() *GitTaskUpsertBulk {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.UpdateShowURL()
|
|
})
|
|
}
|
|
|
|
// ClearShowURL clears the value of the "show_url" field.
|
|
func (u *GitTaskUpsertBulk) ClearShowURL() *GitTaskUpsertBulk {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.ClearShowURL()
|
|
})
|
|
}
|
|
|
|
// SetGithubInstallationID sets the "github_installation_id" field.
|
|
func (u *GitTaskUpsertBulk) SetGithubInstallationID(v int64) *GitTaskUpsertBulk {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.SetGithubInstallationID(v)
|
|
})
|
|
}
|
|
|
|
// AddGithubInstallationID adds v to the "github_installation_id" field.
|
|
func (u *GitTaskUpsertBulk) AddGithubInstallationID(v int64) *GitTaskUpsertBulk {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.AddGithubInstallationID(v)
|
|
})
|
|
}
|
|
|
|
// UpdateGithubInstallationID sets the "github_installation_id" field to the value that was provided on create.
|
|
func (u *GitTaskUpsertBulk) UpdateGithubInstallationID() *GitTaskUpsertBulk {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.UpdateGithubInstallationID()
|
|
})
|
|
}
|
|
|
|
// ClearGithubInstallationID clears the value of the "github_installation_id" field.
|
|
func (u *GitTaskUpsertBulk) ClearGithubInstallationID() *GitTaskUpsertBulk {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.ClearGithubInstallationID()
|
|
})
|
|
}
|
|
|
|
// SetCreatedAt sets the "created_at" field.
|
|
func (u *GitTaskUpsertBulk) SetCreatedAt(v time.Time) *GitTaskUpsertBulk {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.SetCreatedAt(v)
|
|
})
|
|
}
|
|
|
|
// UpdateCreatedAt sets the "created_at" field to the value that was provided on create.
|
|
func (u *GitTaskUpsertBulk) UpdateCreatedAt() *GitTaskUpsertBulk {
|
|
return u.Update(func(s *GitTaskUpsert) {
|
|
s.UpdateCreatedAt()
|
|
})
|
|
}
|
|
|
|
// Exec executes the query.
|
|
func (u *GitTaskUpsertBulk) 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("db: OnConflict was set for builder %d. Set it on the GitTaskCreateBulk instead", i)
|
|
}
|
|
}
|
|
if len(u.create.conflict) == 0 {
|
|
return errors.New("db: missing options for GitTaskCreateBulk.OnConflict")
|
|
}
|
|
return u.create.Exec(ctx)
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (u *GitTaskUpsertBulk) ExecX(ctx context.Context) {
|
|
if err := u.create.Exec(ctx); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|