1
0

add planet

This commit is contained in:
2024-08-01 06:01:28 +09:00
parent a4cd0e0f9a
commit 4c0c396086
17 changed files with 5062 additions and 59 deletions

View File

@@ -750,6 +750,118 @@ func (uc *UserCreate) SetNillableCoinAt(t *time.Time) *UserCreate {
return uc
}
// SetPlanet sets the "planet" field.
func (uc *UserCreate) SetPlanet(i int) *UserCreate {
uc.mutation.SetPlanet(i)
return uc
}
// SetNillablePlanet sets the "planet" field if the given value is not nil.
func (uc *UserCreate) SetNillablePlanet(i *int) *UserCreate {
if i != nil {
uc.SetPlanet(*i)
}
return uc
}
// SetPlanetAt sets the "planet_at" field.
func (uc *UserCreate) SetPlanetAt(t time.Time) *UserCreate {
uc.mutation.SetPlanetAt(t)
return uc
}
// SetNillablePlanetAt sets the "planet_at" field if the given value is not nil.
func (uc *UserCreate) SetNillablePlanetAt(t *time.Time) *UserCreate {
if t != nil {
uc.SetPlanetAt(*t)
}
return uc
}
// SetLogin sets the "login" field.
func (uc *UserCreate) SetLogin(b bool) *UserCreate {
uc.mutation.SetLogin(b)
return uc
}
// SetNillableLogin sets the "login" field if the given value is not nil.
func (uc *UserCreate) SetNillableLogin(b *bool) *UserCreate {
if b != nil {
uc.SetLogin(*b)
}
return uc
}
// SetLoginAt sets the "login_at" field.
func (uc *UserCreate) SetLoginAt(t time.Time) *UserCreate {
uc.mutation.SetLoginAt(t)
return uc
}
// SetNillableLoginAt sets the "login_at" field if the given value is not nil.
func (uc *UserCreate) SetNillableLoginAt(t *time.Time) *UserCreate {
if t != nil {
uc.SetLoginAt(*t)
}
return uc
}
// SetLocationX sets the "location_x" field.
func (uc *UserCreate) SetLocationX(i int) *UserCreate {
uc.mutation.SetLocationX(i)
return uc
}
// SetNillableLocationX sets the "location_x" field if the given value is not nil.
func (uc *UserCreate) SetNillableLocationX(i *int) *UserCreate {
if i != nil {
uc.SetLocationX(*i)
}
return uc
}
// SetLocationY sets the "location_y" field.
func (uc *UserCreate) SetLocationY(i int) *UserCreate {
uc.mutation.SetLocationY(i)
return uc
}
// SetNillableLocationY sets the "location_y" field if the given value is not nil.
func (uc *UserCreate) SetNillableLocationY(i *int) *UserCreate {
if i != nil {
uc.SetLocationY(*i)
}
return uc
}
// SetLocationZ sets the "location_z" field.
func (uc *UserCreate) SetLocationZ(i int) *UserCreate {
uc.mutation.SetLocationZ(i)
return uc
}
// SetNillableLocationZ sets the "location_z" field if the given value is not nil.
func (uc *UserCreate) SetNillableLocationZ(i *int) *UserCreate {
if i != nil {
uc.SetLocationZ(*i)
}
return uc
}
// SetLocationN sets the "location_n" field.
func (uc *UserCreate) SetLocationN(i int) *UserCreate {
uc.mutation.SetLocationN(i)
return uc
}
// SetNillableLocationN sets the "location_n" field if the given value is not nil.
func (uc *UserCreate) SetNillableLocationN(i *int) *UserCreate {
if i != nil {
uc.SetLocationN(*i)
}
return uc
}
// AddCardIDs adds the "card" edge to the Card entity by IDs.
func (uc *UserCreate) AddCardIDs(ids ...int) *UserCreate {
uc.mutation.AddCardIDs(ids...)
@@ -945,6 +1057,18 @@ func (uc *UserCreate) defaults() {
v := user.DefaultCoinAt()
uc.mutation.SetCoinAt(v)
}
if _, ok := uc.mutation.PlanetAt(); !ok {
v := user.DefaultPlanetAt()
uc.mutation.SetPlanetAt(v)
}
if _, ok := uc.mutation.Login(); !ok {
v := user.DefaultLogin
uc.mutation.SetLogin(v)
}
if _, ok := uc.mutation.LoginAt(); !ok {
v := user.DefaultLoginAt()
uc.mutation.SetLoginAt(v)
}
}
// check runs all checks and user-defined validators on the builder.
@@ -1203,6 +1327,38 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) {
_spec.SetField(user.FieldCoinAt, field.TypeTime, value)
_node.CoinAt = value
}
if value, ok := uc.mutation.Planet(); ok {
_spec.SetField(user.FieldPlanet, field.TypeInt, value)
_node.Planet = value
}
if value, ok := uc.mutation.PlanetAt(); ok {
_spec.SetField(user.FieldPlanetAt, field.TypeTime, value)
_node.PlanetAt = value
}
if value, ok := uc.mutation.Login(); ok {
_spec.SetField(user.FieldLogin, field.TypeBool, value)
_node.Login = value
}
if value, ok := uc.mutation.LoginAt(); ok {
_spec.SetField(user.FieldLoginAt, field.TypeTime, value)
_node.LoginAt = value
}
if value, ok := uc.mutation.LocationX(); ok {
_spec.SetField(user.FieldLocationX, field.TypeInt, value)
_node.LocationX = value
}
if value, ok := uc.mutation.LocationY(); ok {
_spec.SetField(user.FieldLocationY, field.TypeInt, value)
_node.LocationY = value
}
if value, ok := uc.mutation.LocationZ(); ok {
_spec.SetField(user.FieldLocationZ, field.TypeInt, value)
_node.LocationZ = value
}
if value, ok := uc.mutation.LocationN(); ok {
_spec.SetField(user.FieldLocationN, field.TypeInt, value)
_node.LocationN = value
}
if nodes := uc.mutation.CardIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,