use build tagged constraint to check api interface implement

pull/703/head
alimy 7 months ago
parent a82c16ccb4
commit 0a79a062f4
No known key found for this signature in database
GPG Key ID: 6964A0C5FE15145A

@ -9,8 +9,6 @@ import (
"github.com/allegro/bigcache/v3"
)
var _ tweetsCache = (*bigCacheTweetsCache)(nil)
type bigCacheTweetsCache struct {
bc *bigcache.BigCache
}

@ -0,0 +1,20 @@
//go:build constraint
package cache
import (
"github.com/rocboss/paopao-ce/internal/core"
)
var (
_ tweetsCache = (*bigCacheTweetsCache)(nil)
_ core.RedisCache = (*redisCache)(nil)
_ tweetsCache = (*redisCacheTweetsCache)(nil)
_ core.CacheIndexService = (*noneCacheIndexServant)(nil)
_ core.VersionInfo = (*noneCacheIndexServant)(nil)
_ core.CacheIndexService = (*simpleCacheIndexServant)(nil)
_ core.VersionInfo = (*simpleCacheIndexServant)(nil)
)

@ -12,11 +12,6 @@ import (
"github.com/rocboss/paopao-ce/pkg/debug"
)
var (
_ core.CacheIndexService = (*noneCacheIndexServant)(nil)
_ core.VersionInfo = (*noneCacheIndexServant)(nil)
)
type noneCacheIndexServant struct {
ips core.IndexPostsService
}

@ -12,12 +12,6 @@ import (
"github.com/Masterminds/semver/v3"
"github.com/redis/rueidis"
"github.com/rocboss/paopao-ce/internal/core"
)
var (
_ core.RedisCache = (*redisCache)(nil)
_ tweetsCache = (*redisCacheTweetsCache)(nil)
)
const (

@ -16,11 +16,6 @@ import (
"github.com/sirupsen/logrus"
)
var (
_ core.CacheIndexService = (*simpleCacheIndexServant)(nil)
_ core.VersionInfo = (*simpleCacheIndexServant)(nil)
)
type simpleCacheIndexServant struct {
ips core.IndexPostsService

@ -0,0 +1,13 @@
//go:build constraint
package jinzhu
import "github.com/rocboss/paopao-ce/internal/core"
var (
_ core.DataService = (*dataSrv)(nil)
_ core.VersionInfo = (*dataSrv)(nil)
_ core.WebDataServantA = (*webDataSrvA)(nil)
_ core.VersionInfo = (*webDataSrvA)(nil)
)

@ -18,15 +18,7 @@ import (
"github.com/rocboss/paopao-ce/internal/dao/security"
)
var (
_ core.DataService = (*dataSrv)(nil)
_ core.VersionInfo = (*dataSrv)(nil)
_ core.WebDataServantA = (*webDataSrvA)(nil)
_ core.VersionInfo = (*webDataSrvA)(nil)
_onceInitial sync.Once
)
var _onceInitial sync.Once
type dataSrv struct {
core.WalletService

@ -12,8 +12,6 @@ import (
"github.com/sirupsen/logrus"
)
var _ core.TweetSearchService = (*bridgeTweetSearchServant)(nil)
type documents struct {
primaryKey []string
docItems []core.TsDocItem

@ -0,0 +1,15 @@
//go:build constraint
package search
import "github.com/rocboss/paopao-ce/internal/core"
var (
_ core.TweetSearchService = (*bridgeTweetSearchServant)(nil)
_ core.TweetSearchService = (*meiliTweetSearchServant)(nil)
_ core.VersionInfo = (*meiliTweetSearchServant)(nil)
_ core.TweetSearchService = (*zincTweetSearchServant)(nil)
_ core.VersionInfo = (*zincTweetSearchServant)(nil)
)

@ -16,11 +16,6 @@ import (
"github.com/sirupsen/logrus"
)
var (
_ core.TweetSearchService = (*meiliTweetSearchServant)(nil)
_ core.VersionInfo = (*meiliTweetSearchServant)(nil)
)
type meiliTweetSearchServant struct {
tweetSearchFilter

@ -15,11 +15,6 @@ import (
"github.com/sirupsen/logrus"
)
var (
_ core.TweetSearchService = (*zincTweetSearchServant)(nil)
_ core.VersionInfo = (*zincTweetSearchServant)(nil)
)
type zincTweetSearchServant struct {
tweetSearchFilter

@ -12,8 +12,6 @@ import (
"github.com/rocboss/paopao-ce/internal/core"
)
var _ core.AttachmentCheckService = (*attachmentCheckServant)(nil)
type attachmentCheckServant struct {
domain string
}

@ -0,0 +1,12 @@
//go:build constraint
package security
import (
"github.com/rocboss/paopao-ce/internal/core"
)
var (
_ core.AttachmentCheckService = (*attachmentCheckServant)(nil)
_ core.PhoneVerifyService = (*juheSmsServant)(nil)
)

@ -7,13 +7,10 @@ import (
"github.com/cockroachdb/errors"
"github.com/rocboss/paopao-ce/internal/conf"
"github.com/rocboss/paopao-ce/internal/core"
"github.com/rocboss/paopao-ce/pkg/json"
"gopkg.in/resty.v1"
)
var _ core.PhoneVerifyService = (*juheSmsServant)(nil)
type juhePhoneCaptchaRsp struct {
ErrorCode int `json:"error_code"`
Reason string `json:"reason"`

@ -16,14 +16,6 @@ import (
"github.com/sirupsen/logrus"
)
var (
_ core.ObjectStorageService = (*aliossServant)(nil)
_ core.OssCreateService = (*aliossCreateServant)(nil)
_ core.OssCreateService = (*aliossCreateRetentionServant)(nil)
_ core.OssCreateService = (*aliossCreateTempDirServant)(nil)
_ core.VersionInfo = (*aliossServant)(nil)
)
type aliossCreateServant struct {
bucket *oss.Bucket
domain string

@ -0,0 +1,37 @@
//go:build constraint
package storage
import (
"github.com/rocboss/paopao-ce/internal/core"
)
var (
_ core.ObjectStorageService = (*aliossServant)(nil)
_ core.OssCreateService = (*aliossCreateServant)(nil)
_ core.OssCreateService = (*aliossCreateRetentionServant)(nil)
_ core.OssCreateService = (*aliossCreateTempDirServant)(nil)
_ core.VersionInfo = (*aliossServant)(nil)
_ core.ObjectStorageService = (*cosServant)(nil)
_ core.OssCreateService = (*cosCreateServant)(nil)
_ core.OssCreateService = (*cosCreateTempDirServant)(nil)
_ core.VersionInfo = (*cosServant)(nil)
_ core.ObjectStorageService = (*huaweiobsServant)(nil)
_ core.OssCreateService = (*hwobsCreateServant)(nil)
_ core.OssCreateService = (*hwobsCreateRetentionServant)(nil)
_ core.OssCreateService = (*hwobsCreateTempDirServant)(nil)
_ core.VersionInfo = (*huaweiobsServant)(nil)
_ core.ObjectStorageService = (*localossServant)(nil)
_ core.OssCreateService = (*localossCreateServant)(nil)
_ core.OssCreateService = (*localossCreateTempDirServant)(nil)
_ core.VersionInfo = (*localossServant)(nil)
_ core.ObjectStorageService = (*minioServant)(nil)
_ core.OssCreateService = (*minioCreateServant)(nil)
_ core.OssCreateService = (*minioCreateRetentionServant)(nil)
_ core.OssCreateService = (*minioCreateTempDirServant)(nil)
_ core.VersionInfo = (*minioServant)(nil)
)

@ -19,13 +19,6 @@ import (
"github.com/tencentyun/cos-go-sdk-v5"
)
var (
_ core.ObjectStorageService = (*cosServant)(nil)
_ core.OssCreateService = (*cosCreateServant)(nil)
_ core.OssCreateService = (*cosCreateTempDirServant)(nil)
_ core.VersionInfo = (*cosServant)(nil)
)
type cosCreateServant struct {
client *cos.Client
domain string

@ -15,14 +15,6 @@ import (
"github.com/sirupsen/logrus"
)
var (
_ core.ObjectStorageService = (*huaweiobsServant)(nil)
_ core.OssCreateService = (*hwobsCreateServant)(nil)
_ core.OssCreateService = (*hwobsCreateRetentionServant)(nil)
_ core.OssCreateService = (*hwobsCreateTempDirServant)(nil)
_ core.VersionInfo = (*huaweiobsServant)(nil)
)
type hwobsCreateServant struct {
client *obs.ObsClient
bucket string

@ -18,13 +18,6 @@ import (
"github.com/sirupsen/logrus"
)
var (
_ core.ObjectStorageService = (*localossServant)(nil)
_ core.OssCreateService = (*localossCreateServant)(nil)
_ core.OssCreateService = (*localossCreateTempDirServant)(nil)
_ core.VersionInfo = (*localossServant)(nil)
)
type localossCreateServant struct {
savePath string
domain string

@ -17,14 +17,6 @@ import (
"github.com/sirupsen/logrus"
)
var (
_ core.ObjectStorageService = (*minioServant)(nil)
_ core.OssCreateService = (*minioCreateServant)(nil)
_ core.OssCreateService = (*minioCreateRetentionServant)(nil)
_ core.OssCreateService = (*minioCreateTempDirServant)(nil)
_ core.VersionInfo = (*minioServant)(nil)
)
type minioCreateServant struct {
client *minio.Client
bucket string

@ -0,0 +1,9 @@
//go:build constraint
package admin
import (
api "github.com/rocboss/paopao-ce/auto/api/m/v1"
)
var _ api.User = (*userSrv)(nil)

@ -9,8 +9,6 @@ import (
"github.com/rocboss/paopao-ce/internal/servants/base"
)
var _ api.User = (*userSrv)(nil)
type userSrv struct {
*base.BaseServant
api.UnimplementedUserServant

@ -0,0 +1,9 @@
//go:build constraint
package bot
import (
api "github.com/rocboss/paopao-ce/auto/api/r/v1"
)
var _ api.User = (*userSrv)(nil)

@ -9,8 +9,6 @@ import (
"github.com/rocboss/paopao-ce/internal/servants/base"
)
var _ api.User = (*userSrv)(nil)
type userSrv struct {
*base.BaseServant
api.UnimplementedUserServant

@ -0,0 +1,9 @@
//go:build constraint
package localoss
import (
api "github.com/rocboss/paopao-ce/auto/api/s/v1"
)
var _ api.User = (*userSrv)(nil)

@ -9,8 +9,6 @@ import (
"github.com/rocboss/paopao-ce/internal/servants/base"
)
var _ api.User = (*userSrv)(nil)
type userSrv struct {
*base.BaseServant
api.UnimplementedUserServant

@ -0,0 +1,9 @@
//go:build constraint
package mobile
import (
api "github.com/rocboss/paopao-ce/auto/rpc/greet/v1"
)
var _ api.GreetServiceServer = (*greetServiceSrv)(nil)

@ -8,8 +8,6 @@ import (
api "github.com/rocboss/paopao-ce/auto/rpc/greet/v1"
)
var _ api.GreetServiceServer = (*greetServiceSrv)(nil)
type greetServiceSrv struct {
api.UnimplementedGreetServiceServer
}

@ -0,0 +1,9 @@
//go:build constraint
package space
import (
api "github.com/rocboss/paopao-ce/auto/api/x/v1"
)
var _ api.User = (*userSrv)(nil)

@ -9,8 +9,6 @@ import (
"github.com/rocboss/paopao-ce/internal/servants/base"
)
var _ api.User = (*userSrv)(nil)
type userSrv struct {
*base.BaseServant
api.UnimplementedUserServant

@ -18,8 +18,6 @@ import (
"github.com/sirupsen/logrus"
)
var _ api.Admin = (*adminSrv)(nil)
type adminSrv struct {
api.UnimplementedAdminServant
*base.DaoServant

@ -16,11 +16,6 @@ import (
"github.com/smartwalle/alipay/v3"
)
var (
_ api.AlipayPub = (*alipayPubSrv)(nil)
_ api.AlipayPriv = (*alipayPrivSrv)(nil)
)
type alipayPubSrv struct {
api.UnimplementedAlipayPubServant
*base.DaoServant

@ -0,0 +1,23 @@
//go:build constraint
package web
import (
api "github.com/rocboss/paopao-ce/auto/api/v1"
)
var (
_ api.Admin = (*adminSrv)(nil)
_ api.AlipayPub = (*alipayPubSrv)(nil)
_ api.AlipayPriv = (*alipayPrivSrv)(nil)
_ api.Core = (*coreSrv)(nil)
_ api.Followship = (*followshipSrv)(nil)
_ api.Friendship = (*friendshipSrv)(nil)
_ api.Loose = (*looseSrv)(nil)
_ api.Pub = (*pubSrv)(nil)
_ api.Relax = (*relaxSrv)(nil)
_ api.Site = (*siteSrv)(nil)
_ api.Trends = (*trendsSrv)(nil)
_ api.Priv = (*privSrv)(nil)
_ api.PrivChain = (*privChain)(nil)
)

@ -29,8 +29,6 @@ var (
_maxCaptchaTimes int = 2
)
var _ api.Core = (*coreSrv)(nil)
type coreSrv struct {
api.UnimplementedCoreServant
*base.DaoServant

@ -15,8 +15,6 @@ import (
"github.com/sirupsen/logrus"
)
var _ api.Followship = (*followshipSrv)(nil)
type followshipSrv struct {
api.UnimplementedFollowshipServant
*base.DaoServant

@ -14,8 +14,6 @@ import (
"github.com/sirupsen/logrus"
)
var _ api.Friendship = (*friendshipSrv)(nil)
type friendshipSrv struct {
api.UnimplementedFriendshipServant
*base.DaoServant

@ -21,8 +21,6 @@ import (
"github.com/sirupsen/logrus"
)
var _ api.Loose = (*looseSrv)(nil)
type looseSrv struct {
api.UnimplementedLooseServant
*base.DaoServant

@ -27,17 +27,12 @@ import (
"github.com/sirupsen/logrus"
)
var (
_ api.Priv = (*privSrv)(nil)
_ api.PrivChain = (*privChain)(nil)
_uploadAttachmentTypeMap = map[string]ms.AttachmentType{
"public/image": ms.AttachmentTypeImage,
"public/avatar": ms.AttachmentTypeImage,
"public/video": ms.AttachmentTypeVideo,
"attachment": ms.AttachmentTypeOther,
}
)
var _uploadAttachmentTypeMap = map[string]ms.AttachmentType{
"public/image": ms.AttachmentTypeImage,
"public/avatar": ms.AttachmentTypeImage,
"public/video": ms.AttachmentTypeVideo,
"attachment": ms.AttachmentTypeOther,
}
type privSrv struct {
api.UnimplementedPrivServant

@ -27,8 +27,6 @@ import (
"github.com/sirupsen/logrus"
)
var _ api.Pub = (*pubSrv)(nil)
const (
_MaxLoginErrTimes = 10
_MaxPhoneCaptcha = 10

@ -15,8 +15,6 @@ import (
"github.com/sirupsen/logrus"
)
var _ api.Relax = (*relaxSrv)(nil)
type relaxSrv struct {
api.UnimplementedRelaxServant
*base.DaoServant

@ -12,8 +12,6 @@ import (
"github.com/rocboss/paopao-ce/pkg/version"
)
var _ api.Site = (*siteSrv)(nil)
type siteSrv struct {
api.UnimplementedSiteServant
*base.BaseServant

@ -18,8 +18,6 @@ import (
"github.com/sirupsen/logrus"
)
var _ api.Trends = (*trendsSrv)(nil)
type trendsSrv struct {
api.UnimplementedTrendsServant
*base.DaoServant

@ -16,8 +16,6 @@ import (
"github.com/rocboss/paopao-ce/internal/servants"
)
var _ Service = (*adminService)(nil)
type adminService struct {
*baseHttpService
}

@ -16,8 +16,6 @@ import (
"github.com/rocboss/paopao-ce/internal/servants"
)
var _ Service = (*botService)(nil)
type botService struct {
*baseHttpService
}

@ -0,0 +1,18 @@
//go:build constraint
package service
var (
_ server = (*grpcServer)(nil)
_ server = (*httpServer)(nil)
_ Service = (*adminService)(nil)
_ Service = (*botService)(nil)
_ Service = (*frontendWebService)(nil)
_ Service = (*localossService)(nil)
_ Service = (*metricsService)(nil)
_ Service = (*pprofService)(nil)
_ Service = (*mobileService)(nil)
_ Service = (*spaceXService)(nil)
_ Service = (*webService)(nil)
)

@ -14,8 +14,6 @@ import (
"github.com/rocboss/paopao-ce/internal/servants"
)
var _ Service = (*frontendWebService)(nil)
type frontendWebService struct {
*baseHttpService
}

@ -10,8 +10,6 @@ import (
"google.golang.org/grpc"
)
var _ server = (*grpcServer)(nil)
// grpcServer wraper for grpc.Server
type grpcServer struct {
*baseServer

@ -11,8 +11,6 @@ import (
"github.com/gin-gonic/gin"
)
var _ server = (*httpServer)(nil)
// httpServer wraper for gin.engine and http.Server
type httpServer struct {
*baseServer

@ -15,8 +15,6 @@ import (
"github.com/rocboss/paopao-ce/internal/servants"
)
var _ Service = (*localossService)(nil)
type localossService struct {
*baseHttpService
}

@ -17,8 +17,6 @@ import (
"github.com/rocboss/paopao-ce/internal/infra/metrics/statistics"
)
var _ Service = (*metricsService)(nil)
type metricsService struct {
*baseHttpService
}

@ -16,8 +16,6 @@ import (
"google.golang.org/grpc"
)
var _ Service = (*mobileService)(nil)
type mobileService struct {
*baseGRPCService
}

@ -13,8 +13,6 @@ import (
"github.com/rocboss/paopao-ce/internal/conf"
)
var _ Service = (*pprofService)(nil)
type pprofService struct {
*baseHttpService
}

@ -16,8 +16,6 @@ import (
"github.com/rocboss/paopao-ce/internal/servants"
)
var _ Service = (*spaceXService)(nil)
type spaceXService struct {
*baseHttpService
}

@ -17,8 +17,6 @@ import (
"github.com/rocboss/paopao-ce/internal/servants"
)
var _ Service = (*webService)(nil)
type webService struct {
*baseHttpService
}

Loading…
Cancel
Save