diff --git a/internal/conf/conf.go b/internal/conf/conf.go index b651bc63..2dad15c7 100644 --- a/internal/conf/conf.go +++ b/internal/conf/conf.go @@ -42,7 +42,7 @@ var ( TweetSearchSetting *tweetSearchConf ZincSetting *zincConf MeiliSetting *meiliConf - ObjectStorage *objectStorageS + ObjectStorage *objectStorageConf AliOSSSetting *aliOSSConf COSSetting *cosConf HuaweiOBSSetting *huaweiOBSConf diff --git a/internal/conf/setting.go b/internal/conf/setting.go index 94ffd26f..39997d60 100644 --- a/internal/conf/setting.go +++ b/internal/conf/setting.go @@ -166,7 +166,7 @@ type sqlite3Conf struct { Path string } -type objectStorageS struct { +type objectStorageConf struct { RetainInDays int TempDir string } @@ -296,6 +296,35 @@ func (s *databaseConf) logLevel() logger.LogLevel { } } +func (s *databaseConf) TableNames() (res TableNameMap) { + tableNames := []string{ + TableAnouncement, + TableAnouncementContent, + TableAttachment, + TableCaptcha, + TableComment, + TableCommentContent, + TableCommentReply, + TableContact, + TableContactGroup, + TableMessage, + TablePost, + TablePostAttachmentBill, + TablePostCollection, + TablePostContent, + TablePostStar, + TableTag, + TableUser, + TableWalletRecharge, + TableWalletStatement, + } + res = make(TableNameMap, len(tableNames)) + for _, name := range tableNames { + res[name] = s.TablePrefix + name + } + return +} + func (s *loggerConf) logLevel() logrus.Level { switch strings.ToLower(s.Level) { case "panic": @@ -343,7 +372,7 @@ func (s *loggerMeiliConf) maxLogBuffer() int { return s.MaxLogBuffer } -func (s *objectStorageS) TempDirSlash() string { +func (s *objectStorageConf) TempDirSlash() string { return strings.Trim(s.TempDir, " /") + "/" }