feat: update

This commit is contained in:
Rogee
2025-05-28 19:40:50 +08:00
parent fa87d18276
commit 1a9dd1d30d
5 changed files with 21 additions and 15 deletions

View File

@@ -1,12 +1,14 @@
// Code generated by the atomctl ; DO NOT EDIT.
// Code generated by the atomctl ; DO NOT EDIT.
// Code generated by the atomctl ; DO NOT EDIT.
package model package model
import ( import (
"context" "context"
"time"
. "github.com/go-jet/jet/v2/postgres" . "github.com/go-jet/jet/v2/postgres"
"github.com/samber/lo" "github.com/samber/lo"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
"time"
) )
// conds // conds
@@ -49,7 +51,6 @@ func (m *Medias) BatchCreate(ctx context.Context, models []*Medias) error {
m.log().WithField("func", "BatchCreate").Infof("Medias items created successfully") m.log().WithField("func", "BatchCreate").Infof("Medias items created successfully")
return nil return nil
} }
func (m *Medias) Delete(ctx context.Context) error { func (m *Medias) Delete(ctx context.Context) error {
stmt := tblMedias.DELETE().WHERE(tblMedias.ID.EQ(Int(m.ID))) stmt := tblMedias.DELETE().WHERE(tblMedias.ID.EQ(Int(m.ID)))
m.log().WithField("func", "Delete").Info(stmt.DebugSql()) m.log().WithField("func", "Delete").Info(stmt.DebugSql())
@@ -82,6 +83,7 @@ func (m *Medias) BatchDelete(ctx context.Context, ids []int64) error {
} }
func (m *Medias) Update(ctx context.Context) error { func (m *Medias) Update(ctx context.Context) error {
stmt := tblMedias.UPDATE(tblMediasUpdateMutableColumns).MODEL(m).WHERE(tblMedias.ID.EQ(Int(m.ID))).RETURNING(tblMedias.AllColumns) stmt := tblMedias.UPDATE(tblMediasUpdateMutableColumns).MODEL(m).WHERE(tblMedias.ID.EQ(Int(m.ID))).RETURNING(tblMedias.AllColumns)
m.log().WithField("func", "Update").Info(stmt.DebugSql()) m.log().WithField("func", "Update").Info(stmt.DebugSql())

View File

@@ -1,12 +1,14 @@
// Code generated by the atomctl ; DO NOT EDIT.
// Code generated by the atomctl ; DO NOT EDIT.
// Code generated by the atomctl ; DO NOT EDIT.
package model package model
import ( import (
"context" "context"
"time"
. "github.com/go-jet/jet/v2/postgres" . "github.com/go-jet/jet/v2/postgres"
"github.com/samber/lo" "github.com/samber/lo"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
"time"
) )
// conds // conds
@@ -50,7 +52,6 @@ func (m *Orders) BatchCreate(ctx context.Context, models []*Orders) error {
m.log().WithField("func", "BatchCreate").Infof("Orders items created successfully") m.log().WithField("func", "BatchCreate").Infof("Orders items created successfully")
return nil return nil
} }
func (m *Orders) Delete(ctx context.Context) error { func (m *Orders) Delete(ctx context.Context) error {
stmt := tblOrders.DELETE().WHERE(tblOrders.ID.EQ(Int(m.ID))) stmt := tblOrders.DELETE().WHERE(tblOrders.ID.EQ(Int(m.ID)))
m.log().WithField("func", "Delete").Info(stmt.DebugSql()) m.log().WithField("func", "Delete").Info(stmt.DebugSql())

View File

@@ -1,12 +1,14 @@
// Code generated by the atomctl ; DO NOT EDIT.
// Code generated by the atomctl ; DO NOT EDIT.
// Code generated by the atomctl ; DO NOT EDIT.
package model package model
import ( import (
"context" "context"
"time"
. "github.com/go-jet/jet/v2/postgres" . "github.com/go-jet/jet/v2/postgres"
"github.com/samber/lo" "github.com/samber/lo"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
"time"
) )
// conds // conds
@@ -61,7 +63,6 @@ func (m *Posts) BatchCreate(ctx context.Context, models []*Posts) error {
m.log().WithField("func", "BatchCreate").Infof("Posts items created successfully") m.log().WithField("func", "BatchCreate").Infof("Posts items created successfully")
return nil return nil
} }
func (m *Posts) Delete(ctx context.Context) error { func (m *Posts) Delete(ctx context.Context) error {
stmt := tblPosts.UPDATE().SET(tblPosts.DeletedAt.SET(TimestampT(time.Now()))).WHERE(tblPosts.ID.EQ(Int(m.ID))) stmt := tblPosts.UPDATE().SET(tblPosts.DeletedAt.SET(TimestampT(time.Now()))).WHERE(tblPosts.ID.EQ(Int(m.ID)))
m.log().WithField("func", "SoftDelete").Info(stmt.DebugSql()) m.log().WithField("func", "SoftDelete").Info(stmt.DebugSql())

View File

@@ -1,12 +1,14 @@
// Code generated by the atomctl ; DO NOT EDIT.
// Code generated by the atomctl ; DO NOT EDIT.
// Code generated by the atomctl ; DO NOT EDIT.
package model package model
import ( import (
"context" "context"
"time"
. "github.com/go-jet/jet/v2/postgres" . "github.com/go-jet/jet/v2/postgres"
"github.com/samber/lo" "github.com/samber/lo"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
"time"
) )
// conds // conds
@@ -50,7 +52,6 @@ func (m *UserPosts) BatchCreate(ctx context.Context, models []*UserPosts) error
m.log().WithField("func", "BatchCreate").Infof("UserPosts items created successfully") m.log().WithField("func", "BatchCreate").Infof("UserPosts items created successfully")
return nil return nil
} }
func (m *UserPosts) Delete(ctx context.Context) error { func (m *UserPosts) Delete(ctx context.Context) error {
stmt := tblUserPosts.DELETE().WHERE(tblUserPosts.ID.EQ(Int(m.ID))) stmt := tblUserPosts.DELETE().WHERE(tblUserPosts.ID.EQ(Int(m.ID)))
m.log().WithField("func", "Delete").Info(stmt.DebugSql()) m.log().WithField("func", "Delete").Info(stmt.DebugSql())

View File

@@ -1,12 +1,14 @@
// Code generated by the atomctl ; DO NOT EDIT.
// Code generated by the atomctl ; DO NOT EDIT.
// Code generated by the atomctl ; DO NOT EDIT.
package model package model
import ( import (
"context" "context"
"time"
. "github.com/go-jet/jet/v2/postgres" . "github.com/go-jet/jet/v2/postgres"
"github.com/samber/lo" "github.com/samber/lo"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
"time"
) )
// conds // conds
@@ -61,7 +63,6 @@ func (m *Users) BatchCreate(ctx context.Context, models []*Users) error {
m.log().WithField("func", "BatchCreate").Infof("Users items created successfully") m.log().WithField("func", "BatchCreate").Infof("Users items created successfully")
return nil return nil
} }
func (m *Users) Delete(ctx context.Context) error { func (m *Users) Delete(ctx context.Context) error {
stmt := tblUsers.UPDATE().SET(tblUsers.DeletedAt.SET(TimestampT(time.Now()))).WHERE(tblUsers.ID.EQ(Int(m.ID))) stmt := tblUsers.UPDATE().SET(tblUsers.DeletedAt.SET(TimestampT(time.Now()))).WHERE(tblUsers.ID.EQ(Int(m.ID)))
m.log().WithField("func", "SoftDelete").Info(stmt.DebugSql()) m.log().WithField("func", "SoftDelete").Info(stmt.DebugSql())