Documentation
¶
Index ¶
- Variables
- func AttachTokenToContext(ctx context.Context, authToken string) context.Context
- func BoolToStr(in bool) string
- func CheckObjectID(hexID string) bool
- func ErrorResponse(err error, msg string) error
- func GenerateObjectID() string
- func GetTokenFromContext(ctx context.Context) (string, error)
- func MapGRPCErrCodeToHttpStatus(code codes.Code) int
- func NewAPILogger(cfg *config.Configuration) *apiLogger
- func ParseGRPCErrStatusCode(err error) codes.Code
- func StrToBool(in string) bool
- type JWTError
- type JsonErr
- type Logger
- type Pagination
- func (q *Pagination) GetHasMore(totalCount int) bool
- func (q *Pagination) GetLimit() int
- func (q *Pagination) GetOffset() int
- func (q *Pagination) GetOrderBy() string
- func (q *Pagination) GetPage() int
- func (q *Pagination) GetQueryString() string
- func (q *Pagination) GetSize() int
- func (q *Pagination) GetTotalPages(totalCount int) int
- func (q *Pagination) SetOrderBy(orderByQuery string)
- func (q *Pagination) SetPage(pageQuery string) error
- func (q *Pagination) SetSize(sizeQuery string) error
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func AttachTokenToContext ¶
AttachTokenToContext inputs ctx and an auth token and returns ctx with token attached
func CheckObjectID ¶
CheckObjectID checks whether a hexID is null or now
func ErrorResponse ¶
ErrorResponse GRPC Error response
func GenerateObjectID ¶
func GenerateObjectID() string
GenerateObjectID for index keying records of data
func GetTokenFromContext ¶
GetTokenFromContext parses an auth token from content metadata
func MapGRPCErrCodeToHttpStatus ¶
MapGRPCErrCodeToHttpStatus Map GRPC errors codes to http status
func NewAPILogger ¶
func NewAPILogger(cfg *config.Configuration) *apiLogger
NewAPILogger Logger constructor
func ParseGRPCErrStatusCode ¶
ParseGRPCErrStatusCode Parse error and get code
Types ¶
type JWTError ¶
type JWTError struct {
Message string `json:"message"`
}
JWTError is a struct that is used to contain a json encoded error message for any JWT related errors
type Logger ¶
type Logger interface { InitLogger() Debug(args ...interface{}) Debugf(template string, args ...interface{}) Info(args ...interface{}) Infof(template string, args ...interface{}) Warn(args ...interface{}) Warnf(template string, args ...interface{}) Error(args ...interface{}) Errorf(template string, args ...interface{}) DPanic(args ...interface{}) DPanicf(template string, args ...interface{}) Fatal(args ...interface{}) Fatalf(template string, args ...interface{}) Printf(template string, args ...interface{}) }
Logger methods interface
type Pagination ¶
type Pagination struct { Size int `json:"size,omitempty"` Page int `json:"page,omitempty"` OrderBy string `json:"orderBy,omitempty"` }
Pagination query params
func NewPaginationQuery ¶
func NewPaginationQuery(size int, page int) *Pagination
func (*Pagination) GetHasMore ¶
func (q *Pagination) GetHasMore(totalCount int) bool
GetHasMore Get has more
func (*Pagination) GetQueryString ¶
func (q *Pagination) GetQueryString() string
GetQueryString get query string
func (*Pagination) GetTotalPages ¶
func (q *Pagination) GetTotalPages(totalCount int) int
GetTotalPages Get total pages int
func (*Pagination) SetOrderBy ¶
func (q *Pagination) SetOrderBy(orderByQuery string)
SetOrderBy Set order by
func (*Pagination) SetPage ¶
func (q *Pagination) SetPage(pageQuery string) error
SetPage Set page number
func (*Pagination) SetSize ¶
func (q *Pagination) SetSize(sizeQuery string) error
SetSize Set page size