1
0

update migrate

This commit is contained in:
2023-04-05 15:05:14 +09:00
parent 9573dc895f
commit 1d5cb2ad9f
87 changed files with 65302 additions and 622 deletions

View File

@ -3,12 +3,12 @@
package ent
import (
"api/ent/card"
"api/ent/predicate"
"api/ent/user"
"context"
"errors"
"fmt"
"t/ent/card"
"t/ent/predicate"
"t/ent/user"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
@ -28,6 +28,187 @@ func (cu *CardUpdate) Where(ps ...predicate.Card) *CardUpdate {
return cu
}
// SetCard sets the "card" field.
func (cu *CardUpdate) SetCard(i int) *CardUpdate {
cu.mutation.ResetCard()
cu.mutation.SetCard(i)
return cu
}
// SetNillableCard sets the "card" field if the given value is not nil.
func (cu *CardUpdate) SetNillableCard(i *int) *CardUpdate {
if i != nil {
cu.SetCard(*i)
}
return cu
}
// AddCard adds i to the "card" field.
func (cu *CardUpdate) AddCard(i int) *CardUpdate {
cu.mutation.AddCard(i)
return cu
}
// ClearCard clears the value of the "card" field.
func (cu *CardUpdate) ClearCard() *CardUpdate {
cu.mutation.ClearCard()
return cu
}
// SetSkill sets the "skill" field.
func (cu *CardUpdate) SetSkill(s string) *CardUpdate {
cu.mutation.SetSkill(s)
return cu
}
// SetNillableSkill sets the "skill" field if the given value is not nil.
func (cu *CardUpdate) SetNillableSkill(s *string) *CardUpdate {
if s != nil {
cu.SetSkill(*s)
}
return cu
}
// ClearSkill clears the value of the "skill" field.
func (cu *CardUpdate) ClearSkill() *CardUpdate {
cu.mutation.ClearSkill()
return cu
}
// SetStatus sets the "status" field.
func (cu *CardUpdate) SetStatus(s string) *CardUpdate {
cu.mutation.SetStatus(s)
return cu
}
// SetNillableStatus sets the "status" field if the given value is not nil.
func (cu *CardUpdate) SetNillableStatus(s *string) *CardUpdate {
if s != nil {
cu.SetStatus(*s)
}
return cu
}
// ClearStatus clears the value of the "status" field.
func (cu *CardUpdate) ClearStatus() *CardUpdate {
cu.mutation.ClearStatus()
return cu
}
// SetToken sets the "token" field.
func (cu *CardUpdate) SetToken(s string) *CardUpdate {
cu.mutation.SetToken(s)
return cu
}
// SetNillableToken sets the "token" field if the given value is not nil.
func (cu *CardUpdate) SetNillableToken(s *string) *CardUpdate {
if s != nil {
cu.SetToken(*s)
}
return cu
}
// ClearToken clears the value of the "token" field.
func (cu *CardUpdate) ClearToken() *CardUpdate {
cu.mutation.ClearToken()
return cu
}
// SetCp sets the "cp" field.
func (cu *CardUpdate) SetCp(i int) *CardUpdate {
cu.mutation.ResetCp()
cu.mutation.SetCp(i)
return cu
}
// SetNillableCp sets the "cp" field if the given value is not nil.
func (cu *CardUpdate) SetNillableCp(i *int) *CardUpdate {
if i != nil {
cu.SetCp(*i)
}
return cu
}
// AddCp adds i to the "cp" field.
func (cu *CardUpdate) AddCp(i int) *CardUpdate {
cu.mutation.AddCp(i)
return cu
}
// ClearCp clears the value of the "cp" field.
func (cu *CardUpdate) ClearCp() *CardUpdate {
cu.mutation.ClearCp()
return cu
}
// SetURL sets the "url" field.
func (cu *CardUpdate) SetURL(s string) *CardUpdate {
cu.mutation.SetURL(s)
return cu
}
// SetNillableURL sets the "url" field if the given value is not nil.
func (cu *CardUpdate) SetNillableURL(s *string) *CardUpdate {
if s != nil {
cu.SetURL(*s)
}
return cu
}
// ClearURL clears the value of the "url" field.
func (cu *CardUpdate) ClearURL() *CardUpdate {
cu.mutation.ClearURL()
return cu
}
// SetCount sets the "count" field.
func (cu *CardUpdate) SetCount(i int) *CardUpdate {
cu.mutation.ResetCount()
cu.mutation.SetCount(i)
return cu
}
// SetNillableCount sets the "count" field if the given value is not nil.
func (cu *CardUpdate) SetNillableCount(i *int) *CardUpdate {
if i != nil {
cu.SetCount(*i)
}
return cu
}
// AddCount adds i to the "count" field.
func (cu *CardUpdate) AddCount(i int) *CardUpdate {
cu.mutation.AddCount(i)
return cu
}
// ClearCount clears the value of the "count" field.
func (cu *CardUpdate) ClearCount() *CardUpdate {
cu.mutation.ClearCount()
return cu
}
// SetAuthor sets the "author" field.
func (cu *CardUpdate) SetAuthor(s string) *CardUpdate {
cu.mutation.SetAuthor(s)
return cu
}
// SetNillableAuthor sets the "author" field if the given value is not nil.
func (cu *CardUpdate) SetNillableAuthor(s *string) *CardUpdate {
if s != nil {
cu.SetAuthor(*s)
}
return cu
}
// ClearAuthor clears the value of the "author" field.
func (cu *CardUpdate) ClearAuthor() *CardUpdate {
cu.mutation.ClearAuthor()
return cu
}
// SetOwnerID sets the "owner" edge to the User entity by ID.
func (cu *CardUpdate) SetOwnerID(id int) *CardUpdate {
cu.mutation.SetOwnerID(id)
@ -97,18 +278,63 @@ func (cu *CardUpdate) sqlSave(ctx context.Context) (n int, err error) {
}
}
}
if value, ok := cu.mutation.Card(); ok {
_spec.SetField(card.FieldCard, field.TypeInt, value)
}
if value, ok := cu.mutation.AddedCard(); ok {
_spec.AddField(card.FieldCard, field.TypeInt, value)
}
if cu.mutation.CardCleared() {
_spec.ClearField(card.FieldCard, field.TypeInt)
}
if value, ok := cu.mutation.Skill(); ok {
_spec.SetField(card.FieldSkill, field.TypeString, value)
}
if cu.mutation.SkillCleared() {
_spec.ClearField(card.FieldSkill, field.TypeString)
}
if value, ok := cu.mutation.Status(); ok {
_spec.SetField(card.FieldStatus, field.TypeString, value)
}
if cu.mutation.StatusCleared() {
_spec.ClearField(card.FieldStatus, field.TypeString)
}
if value, ok := cu.mutation.Token(); ok {
_spec.SetField(card.FieldToken, field.TypeString, value)
}
if cu.mutation.TokenCleared() {
_spec.ClearField(card.FieldToken, field.TypeString)
}
if value, ok := cu.mutation.Cp(); ok {
_spec.SetField(card.FieldCp, field.TypeInt, value)
}
if value, ok := cu.mutation.AddedCp(); ok {
_spec.AddField(card.FieldCp, field.TypeInt, value)
}
if cu.mutation.CpCleared() {
_spec.ClearField(card.FieldCp, field.TypeInt)
}
if value, ok := cu.mutation.URL(); ok {
_spec.SetField(card.FieldURL, field.TypeString, value)
}
if cu.mutation.URLCleared() {
_spec.ClearField(card.FieldURL, field.TypeString)
}
if value, ok := cu.mutation.Count(); ok {
_spec.SetField(card.FieldCount, field.TypeInt, value)
}
if value, ok := cu.mutation.AddedCount(); ok {
_spec.AddField(card.FieldCount, field.TypeInt, value)
}
if cu.mutation.CountCleared() {
_spec.ClearField(card.FieldCount, field.TypeInt)
}
if value, ok := cu.mutation.Author(); ok {
_spec.SetField(card.FieldAuthor, field.TypeString, value)
}
if cu.mutation.AuthorCleared() {
_spec.ClearField(card.FieldAuthor, field.TypeString)
}
if cu.mutation.CreatedAtCleared() {
_spec.ClearField(card.FieldCreatedAt, field.TypeTime)
}
@ -120,10 +346,7 @@ func (cu *CardUpdate) sqlSave(ctx context.Context) (n int, err error) {
Columns: []string{card.OwnerColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: &sqlgraph.FieldSpec{
Type: field.TypeInt,
Column: user.FieldID,
},
IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeInt),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
@ -136,10 +359,7 @@ func (cu *CardUpdate) sqlSave(ctx context.Context) (n int, err error) {
Columns: []string{card.OwnerColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: &sqlgraph.FieldSpec{
Type: field.TypeInt,
Column: user.FieldID,
},
IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeInt),
},
}
for _, k := range nodes {
@ -167,6 +387,187 @@ type CardUpdateOne struct {
mutation *CardMutation
}
// SetCard sets the "card" field.
func (cuo *CardUpdateOne) SetCard(i int) *CardUpdateOne {
cuo.mutation.ResetCard()
cuo.mutation.SetCard(i)
return cuo
}
// SetNillableCard sets the "card" field if the given value is not nil.
func (cuo *CardUpdateOne) SetNillableCard(i *int) *CardUpdateOne {
if i != nil {
cuo.SetCard(*i)
}
return cuo
}
// AddCard adds i to the "card" field.
func (cuo *CardUpdateOne) AddCard(i int) *CardUpdateOne {
cuo.mutation.AddCard(i)
return cuo
}
// ClearCard clears the value of the "card" field.
func (cuo *CardUpdateOne) ClearCard() *CardUpdateOne {
cuo.mutation.ClearCard()
return cuo
}
// SetSkill sets the "skill" field.
func (cuo *CardUpdateOne) SetSkill(s string) *CardUpdateOne {
cuo.mutation.SetSkill(s)
return cuo
}
// SetNillableSkill sets the "skill" field if the given value is not nil.
func (cuo *CardUpdateOne) SetNillableSkill(s *string) *CardUpdateOne {
if s != nil {
cuo.SetSkill(*s)
}
return cuo
}
// ClearSkill clears the value of the "skill" field.
func (cuo *CardUpdateOne) ClearSkill() *CardUpdateOne {
cuo.mutation.ClearSkill()
return cuo
}
// SetStatus sets the "status" field.
func (cuo *CardUpdateOne) SetStatus(s string) *CardUpdateOne {
cuo.mutation.SetStatus(s)
return cuo
}
// SetNillableStatus sets the "status" field if the given value is not nil.
func (cuo *CardUpdateOne) SetNillableStatus(s *string) *CardUpdateOne {
if s != nil {
cuo.SetStatus(*s)
}
return cuo
}
// ClearStatus clears the value of the "status" field.
func (cuo *CardUpdateOne) ClearStatus() *CardUpdateOne {
cuo.mutation.ClearStatus()
return cuo
}
// SetToken sets the "token" field.
func (cuo *CardUpdateOne) SetToken(s string) *CardUpdateOne {
cuo.mutation.SetToken(s)
return cuo
}
// SetNillableToken sets the "token" field if the given value is not nil.
func (cuo *CardUpdateOne) SetNillableToken(s *string) *CardUpdateOne {
if s != nil {
cuo.SetToken(*s)
}
return cuo
}
// ClearToken clears the value of the "token" field.
func (cuo *CardUpdateOne) ClearToken() *CardUpdateOne {
cuo.mutation.ClearToken()
return cuo
}
// SetCp sets the "cp" field.
func (cuo *CardUpdateOne) SetCp(i int) *CardUpdateOne {
cuo.mutation.ResetCp()
cuo.mutation.SetCp(i)
return cuo
}
// SetNillableCp sets the "cp" field if the given value is not nil.
func (cuo *CardUpdateOne) SetNillableCp(i *int) *CardUpdateOne {
if i != nil {
cuo.SetCp(*i)
}
return cuo
}
// AddCp adds i to the "cp" field.
func (cuo *CardUpdateOne) AddCp(i int) *CardUpdateOne {
cuo.mutation.AddCp(i)
return cuo
}
// ClearCp clears the value of the "cp" field.
func (cuo *CardUpdateOne) ClearCp() *CardUpdateOne {
cuo.mutation.ClearCp()
return cuo
}
// SetURL sets the "url" field.
func (cuo *CardUpdateOne) SetURL(s string) *CardUpdateOne {
cuo.mutation.SetURL(s)
return cuo
}
// SetNillableURL sets the "url" field if the given value is not nil.
func (cuo *CardUpdateOne) SetNillableURL(s *string) *CardUpdateOne {
if s != nil {
cuo.SetURL(*s)
}
return cuo
}
// ClearURL clears the value of the "url" field.
func (cuo *CardUpdateOne) ClearURL() *CardUpdateOne {
cuo.mutation.ClearURL()
return cuo
}
// SetCount sets the "count" field.
func (cuo *CardUpdateOne) SetCount(i int) *CardUpdateOne {
cuo.mutation.ResetCount()
cuo.mutation.SetCount(i)
return cuo
}
// SetNillableCount sets the "count" field if the given value is not nil.
func (cuo *CardUpdateOne) SetNillableCount(i *int) *CardUpdateOne {
if i != nil {
cuo.SetCount(*i)
}
return cuo
}
// AddCount adds i to the "count" field.
func (cuo *CardUpdateOne) AddCount(i int) *CardUpdateOne {
cuo.mutation.AddCount(i)
return cuo
}
// ClearCount clears the value of the "count" field.
func (cuo *CardUpdateOne) ClearCount() *CardUpdateOne {
cuo.mutation.ClearCount()
return cuo
}
// SetAuthor sets the "author" field.
func (cuo *CardUpdateOne) SetAuthor(s string) *CardUpdateOne {
cuo.mutation.SetAuthor(s)
return cuo
}
// SetNillableAuthor sets the "author" field if the given value is not nil.
func (cuo *CardUpdateOne) SetNillableAuthor(s *string) *CardUpdateOne {
if s != nil {
cuo.SetAuthor(*s)
}
return cuo
}
// ClearAuthor clears the value of the "author" field.
func (cuo *CardUpdateOne) ClearAuthor() *CardUpdateOne {
cuo.mutation.ClearAuthor()
return cuo
}
// SetOwnerID sets the "owner" edge to the User entity by ID.
func (cuo *CardUpdateOne) SetOwnerID(id int) *CardUpdateOne {
cuo.mutation.SetOwnerID(id)
@ -266,18 +667,63 @@ func (cuo *CardUpdateOne) sqlSave(ctx context.Context) (_node *Card, err error)
}
}
}
if value, ok := cuo.mutation.Card(); ok {
_spec.SetField(card.FieldCard, field.TypeInt, value)
}
if value, ok := cuo.mutation.AddedCard(); ok {
_spec.AddField(card.FieldCard, field.TypeInt, value)
}
if cuo.mutation.CardCleared() {
_spec.ClearField(card.FieldCard, field.TypeInt)
}
if value, ok := cuo.mutation.Skill(); ok {
_spec.SetField(card.FieldSkill, field.TypeString, value)
}
if cuo.mutation.SkillCleared() {
_spec.ClearField(card.FieldSkill, field.TypeString)
}
if value, ok := cuo.mutation.Status(); ok {
_spec.SetField(card.FieldStatus, field.TypeString, value)
}
if cuo.mutation.StatusCleared() {
_spec.ClearField(card.FieldStatus, field.TypeString)
}
if value, ok := cuo.mutation.Token(); ok {
_spec.SetField(card.FieldToken, field.TypeString, value)
}
if cuo.mutation.TokenCleared() {
_spec.ClearField(card.FieldToken, field.TypeString)
}
if value, ok := cuo.mutation.Cp(); ok {
_spec.SetField(card.FieldCp, field.TypeInt, value)
}
if value, ok := cuo.mutation.AddedCp(); ok {
_spec.AddField(card.FieldCp, field.TypeInt, value)
}
if cuo.mutation.CpCleared() {
_spec.ClearField(card.FieldCp, field.TypeInt)
}
if value, ok := cuo.mutation.URL(); ok {
_spec.SetField(card.FieldURL, field.TypeString, value)
}
if cuo.mutation.URLCleared() {
_spec.ClearField(card.FieldURL, field.TypeString)
}
if value, ok := cuo.mutation.Count(); ok {
_spec.SetField(card.FieldCount, field.TypeInt, value)
}
if value, ok := cuo.mutation.AddedCount(); ok {
_spec.AddField(card.FieldCount, field.TypeInt, value)
}
if cuo.mutation.CountCleared() {
_spec.ClearField(card.FieldCount, field.TypeInt)
}
if value, ok := cuo.mutation.Author(); ok {
_spec.SetField(card.FieldAuthor, field.TypeString, value)
}
if cuo.mutation.AuthorCleared() {
_spec.ClearField(card.FieldAuthor, field.TypeString)
}
if cuo.mutation.CreatedAtCleared() {
_spec.ClearField(card.FieldCreatedAt, field.TypeTime)
}
@ -289,10 +735,7 @@ func (cuo *CardUpdateOne) sqlSave(ctx context.Context) (_node *Card, err error)
Columns: []string{card.OwnerColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: &sqlgraph.FieldSpec{
Type: field.TypeInt,
Column: user.FieldID,
},
IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeInt),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
@ -305,10 +748,7 @@ func (cuo *CardUpdateOne) sqlSave(ctx context.Context) (_node *Card, err error)
Columns: []string{card.OwnerColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: &sqlgraph.FieldSpec{
Type: field.TypeInt,
Column: user.FieldID,
},
IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeInt),
},
}
for _, k := range nodes {