updated deps; switched sitemap lib; ent regen
This commit is contained in:
@@ -70,49 +70,7 @@ func (rsc *RoundStatsCreate) Mutation() *RoundStatsMutation {
|
||||
|
||||
// Save creates the RoundStats in the database.
|
||||
func (rsc *RoundStatsCreate) Save(ctx context.Context) (*RoundStats, error) {
|
||||
var (
|
||||
err error
|
||||
node *RoundStats
|
||||
)
|
||||
if len(rsc.hooks) == 0 {
|
||||
if err = rsc.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
node, err = rsc.sqlSave(ctx)
|
||||
} else {
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*RoundStatsMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
if err = rsc.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
rsc.mutation = mutation
|
||||
if node, err = rsc.sqlSave(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
mutation.id = &node.ID
|
||||
mutation.done = true
|
||||
return node, err
|
||||
})
|
||||
for i := len(rsc.hooks) - 1; i >= 0; i-- {
|
||||
if rsc.hooks[i] == nil {
|
||||
return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = rsc.hooks[i](mut)
|
||||
}
|
||||
v, err := mut.Mutate(ctx, rsc.mutation)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
nv, ok := v.(*RoundStats)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected node type %T returned from RoundStatsMutation", v)
|
||||
}
|
||||
node = nv
|
||||
}
|
||||
return node, err
|
||||
return withHooks[*RoundStats, RoundStatsMutation](ctx, rsc.sqlSave, rsc.mutation, rsc.hooks)
|
||||
}
|
||||
|
||||
// SaveX calls Save and panics if Save returns an error.
|
||||
@@ -155,6 +113,9 @@ func (rsc *RoundStatsCreate) check() error {
|
||||
}
|
||||
|
||||
func (rsc *RoundStatsCreate) sqlSave(ctx context.Context) (*RoundStats, error) {
|
||||
if err := rsc.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_node, _spec := rsc.createSpec()
|
||||
if err := sqlgraph.CreateNode(ctx, rsc.driver, _spec); err != nil {
|
||||
if sqlgraph.IsConstraintError(err) {
|
||||
@@ -164,19 +125,15 @@ func (rsc *RoundStatsCreate) sqlSave(ctx context.Context) (*RoundStats, error) {
|
||||
}
|
||||
id := _spec.ID.Value.(int64)
|
||||
_node.ID = int(id)
|
||||
rsc.mutation.id = &_node.ID
|
||||
rsc.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
|
||||
func (rsc *RoundStatsCreate) createSpec() (*RoundStats, *sqlgraph.CreateSpec) {
|
||||
var (
|
||||
_node = &RoundStats{config: rsc.config}
|
||||
_spec = &sqlgraph.CreateSpec{
|
||||
Table: roundstats.Table,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: roundstats.FieldID,
|
||||
},
|
||||
}
|
||||
_spec = sqlgraph.NewCreateSpec(roundstats.Table, sqlgraph.NewFieldSpec(roundstats.FieldID, field.TypeInt))
|
||||
)
|
||||
if value, ok := rsc.mutation.Round(); ok {
|
||||
_spec.SetField(roundstats.FieldRound, field.TypeUint, value)
|
||||
|
Reference in New Issue
Block a user