feat: update
This commit is contained in:
@@ -37,7 +37,7 @@ func (m *Posts) Create(ctx context.Context) error {
|
||||
m.CreatedAt = time.Now()
|
||||
m.UpdatedAt = time.Now()
|
||||
|
||||
stmt := tblMedias.INSERT(tblPosts.MutableColumns).MODEL(m).RETURNING(tblMedias.AllColumns)
|
||||
stmt := tblPosts.INSERT(tblPosts.MutableColumns).MODEL(m).RETURNING(tblPosts.AllColumns)
|
||||
m.log().WithField("func", "Create").Info(stmt.DebugSql())
|
||||
|
||||
if err := stmt.QueryContext(ctx, db, m); err != nil {
|
||||
@@ -163,8 +163,7 @@ func (m *Posts) GetByID(ctx context.Context, id int64, conds ...Cond) (*Posts, e
|
||||
func (m *Posts) Count(ctx context.Context, conds ...Cond) (int64, error) {
|
||||
cond := CondTrue(conds...)
|
||||
|
||||
tbl := tblPosts
|
||||
stmt := tbl.SELECT(COUNT(tbl.ID).AS("count")).WHERE(cond)
|
||||
stmt := tblPosts.SELECT(COUNT(tblPosts.ID).AS("count")).WHERE(cond)
|
||||
m.log().Infof("sql: %s", stmt.DebugSql())
|
||||
|
||||
var count struct {
|
||||
|
||||
Reference in New Issue
Block a user