Documentation ¶
Index ¶
- Variables
- func AddQueryParams(r *http.Request, params map[string]string)
- func Contains[T comparable](s []T, e T) bool
- func CopyHttpRequest(r *http.Request) *http.Request
- func CreateDir(dir string) error
- func Decrypt(encoded string, key []byte) ([]byte, error)
- func DisabledCookie(name string, httpsEnable bool) *http.Cookie
- func Encrypt(plaintext, key []byte) (string, error)
- func GormErrorWithLogger(ctx context.Context) func(err error, formatWithArgs ...interface{}) error
- func NewMutexMap[T any]() *mutexMap[T]
- func Paginate(page int64, pageSize int64) func(db *gorm.DB) *gorm.DB
- func ParseEndpoint(platform, rawEndpoint string) (string, string, error)
- func PathHasPrefix(path string, routes []string) bool
- func PathMatchPattern(path string, patterns []*regexp.Regexp) bool
- func ReadPartFile(path string) ([]string, error)
- type GormErrorWrapper
- type WithErrorMessage
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ReserveRequestRoutes = []string{ "/api-nebula/db/", "/api/files", "/api/import-tasks", } ReserveResponseRoutes = []string{ "/api-nebula/db/", "/api/import-tasks", } IgnoreHandlerBodyPatterns = []*regexp.Regexp{ regexp.MustCompile(`^/api/import-tasks/\w+/download`), } )
Functions ¶
func AddQueryParams ¶
dynamicly add query params to the request
func Contains ¶
func Contains[T comparable](s []T, e T) bool
func Decrypt ¶
Decrypt decrypts a base64-encoded ciphertext using AES encryption with a given key. It returns the plaintext.
func Encrypt ¶
Encrypt encrypts plaintext using AES encryption with a given key. It returns a base64-encoded ciphertext.
func GormErrorWithLogger ¶
func NewMutexMap ¶
func NewMutexMap[T any]() *mutexMap[T]
func PathHasPrefix ¶
func ReadPartFile ¶
read part of file: top 50 lines and bottom 50 lines
Types ¶
type GormErrorWrapper ¶
type WithErrorMessage ¶
func ErrMsgWithLogger ¶
func ErrMsgWithLogger(ctx context.Context) WithErrorMessage
Click to show internal directories.
Click to hide internal directories.