Documentation ¶
Overview ¶
Package lib is a generated GoMock package.
Index ¶
- func Code(err error, code int) error
- func CreateHttpClient(conn redis.Conn) *http.Client
- func Error(code int, s string) error
- func Errorf(code int, s string, args ...interface{}) error
- func GenSnowflake() snowflake.ID
- func GenToken() (string, error)
- func GetDB(ctx context.Context) *gorm.DB
- func GetHttpClient(ctx context.Context) *http.Client
- func GetLogger(ctx context.Context) *zap.Logger
- func GetRedis(ctx context.Context) *redis.Client
- func NormalizeURL(u url.URL) url.URL
- func Report(ctx context.Context, err error, msg string)
- func RootURL(url url.URL) url.URL
- func WithDB(ctx context.Context, db *gorm.DB) context.Context
- func WithHttpClient(ctx context.Context, cli *http.Client) context.Context
- func WithLogger(ctx context.Context, l *zap.Logger) context.Context
- func WithLoggerFields(ctx context.Context, f ...zap.Field) context.Context
- func WithNamedLogger(ctx context.Context, name string) context.Context
- func WithRedis(ctx context.Context, r *redis.Client) context.Context
- func Wrap(err error, code int, s string) error
- func Wrapf(err error, code int, s string, args ...interface{}) error
- type Err
- type MockSnowflakeGenerator
- type MockSnowflakeGeneratorMockRecorder
- type SnowflakeGenerator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateHttpClient ¶
CreateHttpClient creates a http.Client instance which will cache responses inside our Redis database
func GetHttpClient ¶
GetHttpClient returns the Http client associated with the context, or nil
func GetLogger ¶
GetLogger returns the logger associated with the context, or the global logger if none is set.
func Report ¶
Report logs an error to the global logger. Useful for `defer conn.Close()`-type constructs, where there's not really anything useful to do with the error, but you still want to log it.
func WithHttpClient ¶
WithHttpClient associates the HttpClient with a context
func WithLogger ¶
WithLogger associates a logger with a context.
func WithNamedLogger ¶
WithLogger is a shorthand for associating a named sub-logger with a context.
Types ¶
type MockSnowflakeGenerator ¶
type MockSnowflakeGenerator struct {
// contains filtered or unexported fields
}
MockSnowflakeGenerator is a mock of SnowflakeGenerator interface
func NewMockSnowflakeGenerator ¶
func NewMockSnowflakeGenerator(ctrl *gomock.Controller) *MockSnowflakeGenerator
NewMockSnowflakeGenerator creates a new mock instance
func (*MockSnowflakeGenerator) EXPECT ¶
func (m *MockSnowflakeGenerator) EXPECT() *MockSnowflakeGeneratorMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockSnowflakeGenerator) Generate ¶
func (m *MockSnowflakeGenerator) Generate() snowflake.ID
Generate mocks base method
type MockSnowflakeGeneratorMockRecorder ¶
type MockSnowflakeGeneratorMockRecorder struct {
// contains filtered or unexported fields
}
MockSnowflakeGeneratorMockRecorder is the mock recorder for MockSnowflakeGenerator
func (*MockSnowflakeGeneratorMockRecorder) Generate ¶
func (mr *MockSnowflakeGeneratorMockRecorder) Generate() *gomock.Call
Generate indicates an expected call of Generate
type SnowflakeGenerator ¶
var DefaultSnowflakeGenerator SnowflakeGenerator
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package redis provides a redis interface for http caching.
|
Package redis provides a redis interface for http caching. |