feat: add upload logics

This commit is contained in:
Rogee
2024-09-04 13:08:22 +08:00
parent a035a63f52
commit 06f4fed3ed
4 changed files with 97 additions and 34 deletions

View File

@@ -5,6 +5,7 @@ import (
"testing"
"time"
"exporter/database/telegram_resource/public/model"
"exporter/database/telegram_resource/public/table"
"github.com/samber/lo"
@@ -56,12 +57,23 @@ func Test_Join(t *testing.T) {
if err := InitDB(dsn); err != nil {
t.Error(err)
}
// db.Exec(`truncate channel_messages`)
var msg struct {
model.ChannelMessages
model.Channels
}
tblC := table.Channels
tbl := table.ChannelMessages
stmt := tbl.SELECT(tbl.AllColumns, tblC.Title).
WHERE(tbl.Published.IS_TRUE()).
WHERE(tbl.Published.IS_FALSE()).
LIMIT(1).
FROM(tbl.LEFT_JOIN(tblC, tbl.ChannelID.EQ(tblC.UUID)))
t.Log(stmt.DebugSql())
if err := stmt.QueryContext(context.Background(), db, &msg); err != nil {
t.Error(err)
}
t.Logf("%+v", msg)
}