Documentation
¶
Index ¶
- func CalculatePKCEChallengeS256(codeVerifier string) string
- func CopyRequestBody(r *http.Request) ([]byte, error)
- func DaysLeft(targetDate time.Time) int
- func DecodeToUTF8(s string) (string, error)
- func EstimateTokenCount(text string) int
- func GenerateRandomString(length int) string
- func HashString(s string) string
- func IntToObjectId(id uint) *string
- func KeyValueInt32OrZero(dat map[string]any, key string) int
- func KeyValueOrZero(dat map[string]any, key string) int
- func SendErrorResponse(c *gin.Context, err error)
- func ValidateEmailDomain(email string) error
- type ErrorResponse
- func NewBadRequestError(message string) ErrorResponse
- func NewForbiddenError(message string) ErrorResponse
- func NewInternalServerError(message string) ErrorResponse
- func NewNotFoundError(message string) ErrorResponse
- func NewPaymentRequiredError(message string) ErrorResponse
- func NewUnauthorizedError(message string) ErrorResponse
- type JSONMapAccessor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculatePKCEChallengeS256 ¶
CalculatePKCEChallengeS256 calculates the S256 PKCE code challenge. It takes the code verifier, computes its SHA256 hash, and then Base64 URL encodes the hash.
func DecodeToUTF8 ¶
func EstimateTokenCount ¶
func GenerateRandomString ¶
func HashString ¶
func IntToObjectId ¶
func SendErrorResponse ¶
SendErrorResponse sends a standardized error response to the client It handles different error types, particularly ErrorResponse
func ValidateEmailDomain ¶
Types ¶
type ErrorResponse ¶
func NewForbiddenError ¶
func NewForbiddenError(message string) ErrorResponse
func NewInternalServerError ¶
func NewInternalServerError(message string) ErrorResponse
func NewNotFoundError ¶
func NewNotFoundError(message string) ErrorResponse
func NewPaymentRequiredError ¶
func NewPaymentRequiredError(message string) ErrorResponse
func NewUnauthorizedError ¶
func NewUnauthorizedError(message string) ErrorResponse
func (ErrorResponse) Error ¶
func (e ErrorResponse) Error() string
type JSONMapAccessor ¶
type JSONMapAccessor struct {
// contains filtered or unexported fields
}
JSONMapAccessor provides convenient access to values in a JSONMap
func NewJSONMapAccessor ¶
func NewJSONMapAccessor(data map[string]interface{}) *JSONMapAccessor
NewJSONMapAccessor creates a new JSONMapAccessor
func (*JSONMapAccessor) GetSlice ¶
func (a *JSONMapAccessor) GetSlice(key string) []interface{}
GetSlice retrieves a []interface{} value from the JSONMap
func (*JSONMapAccessor) GetString ¶
func (a *JSONMapAccessor) GetString(key, defaultValue string) string
GetString retrieves a string value from the JSONMap
Click to show internal directories.
Click to hide internal directories.