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