Documentation ¶
Index ¶
- Variables
- func ConstructKey(prefix, key string) string
- func CorsMiddleware() gin.HandlerFunc
- func ExtractTokenFromHeader(r *http.Request) string
- func GetEnv(key, fallback string) string
- func GetPageNumber(page string) int
- func GetServerAddrs(addrs string) []string
- func InitLogger(mode string)
- func InitializeGrpcClient(svcHost string) (*grpc.ClientConn, error)
- func InitializeGrpcServer(logger GrpcLogger) *grpc.Server
- func Join(strs ...string) string
- func LogTraceUnary() grpc.UnaryServerInterceptor
- func LoggingMiddleware(logger HttpLogger) gin.HandlerFunc
- func MaxAllowed(n int64) gin.HandlerFunc
- func NewGrpcEndpoint(conn *grpc.ClientConn, serviceID, serviceName, method string, ...) endpoint.Endpoint
- type Closer
- type ErrResponse
- type GrpcLogger
- type GrpcServer
- type HttpLogger
- type HttpServer
- type IDGenerator
- type Migrator
- type Pagination
- type Runner
- type SQLMigrator
- type Server
- type SuccessPagingResponse
- type SuccessResponse
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidParam = errors.New("invalid parameter") ErrServer = errors.New("server error") )
View Source
var ( JWTAuthHeader = "Authorization" JaegerHeader = "Trace-Id" )
View Source
var (
DefaultLimit int64 = 20
)
View Source
var (
ServiceIdHeader string = "Service-Id"
)
Functions ¶
func ConstructKey ¶
func CorsMiddleware ¶
func CorsMiddleware() gin.HandlerFunc
func ExtractTokenFromHeader ¶
func GetPageNumber ¶
func GetServerAddrs ¶
func InitLogger ¶
func InitLogger(mode string)
func InitializeGrpcClient ¶ added in v0.1.7
func InitializeGrpcClient(svcHost string) (*grpc.ClientConn, error)
func InitializeGrpcServer ¶ added in v0.1.7
func InitializeGrpcServer(logger GrpcLogger) *grpc.Server
func LogTraceUnary ¶ added in v0.1.7
func LogTraceUnary() grpc.UnaryServerInterceptor
LogTraceUnary logs trace id from the incoming request context
func LoggingMiddleware ¶
func LoggingMiddleware(logger HttpLogger) gin.HandlerFunc
func MaxAllowed ¶
func MaxAllowed(n int64) gin.HandlerFunc
func NewGrpcEndpoint ¶ added in v0.1.7
func NewGrpcEndpoint(conn *grpc.ClientConn, serviceID, serviceName, method string, grpcReply interface{}) endpoint.Endpoint
Types ¶
type ErrResponse ¶
type GrpcLogger ¶ added in v0.1.7
func NewGrpcLogger ¶ added in v0.1.7
func NewGrpcLogger() GrpcLogger
type GrpcServer ¶
type GrpcServer interface { Register() Run() GracefulShutdown() }
type HttpLogger ¶
func NewHttpLogger ¶
func NewHttpLogger() HttpLogger
type HttpServer ¶
type IDGenerator ¶
func NewIDGenerator ¶
func NewIDGenerator() (IDGenerator, error)
type Pagination ¶
type SQLMigrator ¶ added in v0.1.6
type SQLMigrator struct {
// contains filtered or unexported fields
}
func NewSQLMigrator ¶ added in v0.1.6
func NewSQLMigrator(migrator Migrator) *SQLMigrator
func (*SQLMigrator) Migrate ¶ added in v0.1.6
func (m *SQLMigrator) Migrate() error
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) GracefulShutdown ¶
type SuccessPagingResponse ¶
type SuccessPagingResponse[T any] struct { Success bool `json:"success" example:"true"` Data T `json:"data"` Pagination Pagination `json:"pagination"` }
type SuccessResponse ¶
Click to show internal directories.
Click to hide internal directories.