utils

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindValidate

func BindValidate(c echo.Context, data any) error

BindValidate binds and validates the request body

func DirWithSlash

func DirWithSlash(id string) string

DirWithSlash returns the dir with slash

func GenPathByDigest

func GenPathByDigest(digest digest.Digest) string

GenPathByDigest generates the path by the digest.

func GetContentLength

func GetContentLength(req *http.Request) (int64, error)

GetContentLength returns the content length of the request.

func GetUserFromCtx added in v1.2.0

func GetUserFromCtx(c echo.Context) (*models.User, bool, error)

GetUserFromCtx ...

func GetUserFromCtxForDs added in v1.3.0

func GetUserFromCtxForDs(c echo.Context) (*models.User, bool, error)

GetUserFromCtxForDs ...

func Inject

func Inject(target any, source any) error

Inject injects source to target if source is not nil

func IsDir

func IsDir(dir string) bool

IsDir returns true if given path is a directory, or returns false when it's a file or does not exist.

func IsExist

func IsExist(path string) bool

IsExist checks whether a file or directory exists. It returns false when the file or directory does not exist.

func IsFile

func IsFile(filePath string) bool

IsFile returns true if given path is a file, or returns false when it's a directory or does not exist.

func MustMarshal

func MustMarshal(in any) []byte

MustMarshal marshals the given object to bytes.

func NormalizePagination

func NormalizePagination(in types.Pagination) types.Pagination

NormalizePagination normalizes the pagination

func PanicIf

func PanicIf(err error)

PanicIf panics if err is not nil

func StringsJoin

func StringsJoin[T stringsJoin](strs []T, sep string) string

StringsJoin ...

func TrimHTTP

func TrimHTTP(in string) string

TrimHTTP ...

func UnwrapJoinedErrors added in v1.1.0

func UnwrapJoinedErrors(err error) string

UnwrapJoinedErrors ...

Types

This section is empty.

Directories

Path Synopsis
Package imagerefs ...
Package imagerefs ...
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
Package ptr ...
Package ptr ...
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL