feat: add medias

This commit is contained in:
Rogee
2024-12-02 17:48:46 +08:00
parent 2b4cfb1a1e
commit 9e7b35e3c9
17 changed files with 806 additions and 11 deletions

View File

@@ -19,7 +19,7 @@ func FromContext(ctx context.Context, db *sql.DB) qrm.DB {
func TruncateAllTables(ctx context.Context, db *sql.DB, tableName ...string) error {
for _, name := range tableName {
sql := fmt.Sprintf("TRUNCATE TABLE %s CASCADE", name)
sql := fmt.Sprintf("TRUNCATE TABLE %s RESTART IDENTITY", name)
if _, err := db.ExecContext(ctx, sql); err != nil {
return err
}

View File

@@ -0,0 +1,7 @@
package db
type Pagination struct {
Offset string `json:"offset"`
OffsetID int64 `json:"-"`
Action int `json:"action"` // action: 0 :加载更多 1:刷新
}