Documentation
¶
Overview ¶
Package gotest is a library that simulates the testing of cache, dao and handler.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
Ctx context.Context
TestDataSlice []interface{}
TestDataMap map[string]interface{}
RedisClient *redis.Client
ICache interface{}
// contains filtered or unexported fields
}
Cache redis cache
func (*Cache) GetTestData ¶
GetTestData get test data
type Dao ¶
type Dao struct {
Ctx context.Context
TestData interface{}
SQLMock sqlmock.Sqlmock
Cache *Cache
DB *gorm.DB
IDao interface{}
AnyTime *anyTime
// contains filtered or unexported fields
}
Dao dao info
func (*Dao) GetAnyArgs ¶
GetAnyArgs Dynamic generation of parameter types based on structures
type Handler ¶
type Handler struct {
TestData interface{}
MockDao *Dao
IHandler interface{}
Engine *gin.Engine
HTTPServer *http.Server
// contains filtered or unexported fields
}
Handler info
func NewHandler ¶
NewHandler instantiated handler
func (*Handler) GetRequestURL ¶
GetRequestURL get request url from name
func (*Handler) GoRunHTTPServer ¶
func (h *Handler) GoRunHTTPServer(fns []RouterInfo)
GoRunHTTPServer run http server
type RCCache ¶
type RCCache struct {
Ctx context.Context
TestDataSlice []interface{}
TestDataMap map[string]interface{}
RedisClient *redis.ClusterClient
ICache interface{}
// contains filtered or unexported fields
}
RCCache redis cluster cache
func NewRCCache ¶
NewRCCache instantiated redis cluster cache
func (*RCCache) GetTestData ¶
GetTestData get test data
type RouterInfo ¶
type RouterInfo struct {
FuncName string
Method string
Path string
HandlerFunc gin.HandlerFunc
}
RouterInfo router info
type Service ¶
type Service struct {
Ctx context.Context
TestData interface{}
MockDao *Dao
Server *grpc.Server
IServiceClient interface{}
// contains filtered or unexported fields
}
Service info
func NewService ¶
NewService instantiated service
func (*Service) GetClientConn ¶
func (s *Service) GetClientConn() *grpc.ClientConn
GetClientConn dial rpc server
Click to show internal directories.
Click to hide internal directories.