utils

package
v0.0.51 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2025 License: 0BSD Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Logger = shared.ProvideLogger(os.Getenv("LOG_LEVEL"))

Functions

func DoesMatchSaltedHash added in v0.0.45

func DoesMatchSaltedHash(clearText, saltedHash string) bool

func Execute added in v0.0.45

func Execute(commandStr string)

func ExecuteShellCommand added in v0.0.45

func ExecuteShellCommand(shellCommand string) error

func FindDir added in v0.0.49

func FindDir(dirName string) string

func GenerateCookie added in v0.0.22

func GenerateCookie() (*http.Cookie, error)

func GetCorsDisablingHandler added in v0.0.21

func GetCorsDisablingHandler(next http.Handler) http.Handler

GetCorsDisablingHandler This is necessary to allow cross-origin requests.

func GetErrMsg

func GetErrMsg(actualStatusCode int, respBodyMsg string) string

func GetTimeIn30Days added in v0.0.22

func GetTimeIn30Days() time.Time

func Hash added in v0.0.23

func Hash(clearText string) (string, error)

func RunMigrations added in v0.0.50

func RunMigrations(migrationsDir, host string)

func SaltAndHash added in v0.0.23

func SaltAndHash(clearText string) (string, error)

func SendJsonResponse

func SendJsonResponse(w http.ResponseWriter, data interface{})

func SetCookieHeaders added in v0.0.35

func SetCookieHeaders(req *http.Request, c *ComponentClient)

func UnpackResponse added in v0.0.32

func UnpackResponse[T any](object interface{}) (*T, error)

func UnzipToTempDir added in v0.0.42

func UnzipToTempDir(zipBytes []byte) (string, error)

TODO To be tested UnzipToTempDir unzips the given zip bytes to a temporary directory and returns the path to the directory.

func WaitForPostgresDb added in v0.0.51

func WaitForPostgresDb(host string) (*sql.DB, error)

func ZipDirectoryToBytes added in v0.0.30

func ZipDirectoryToBytes(dirPath string) ([]byte, error)

Types

type ChangePasswordForm

type ChangePasswordForm struct {
	OldPassword string `json:"old_password"`
	NewPassword string `json:"new_password"`
}

TODO to be removed

type ComponentClient

type ComponentClient struct {
	User              string
	Password          string
	NewPassword       string
	Cookie            *http.Cookie
	SetCookieHeader   bool
	RootUrl           string
	Origin            string
	VerifyCertificate bool
}

func (*ComponentClient) DoRequest

func (c *ComponentClient) DoRequest(path string, payload interface{}, expectedMessage string) ([]byte, error)

func (*ComponentClient) DoRequestWithFullResponse

func (c *ComponentClient) DoRequestWithFullResponse(path string, payload interface{}, expectedMessage string) (*http.Response, error)

type SingleInteger added in v0.0.33

type SingleInteger struct {
	Value int `json:"value"`
}

type SingleString

type SingleString struct {
	Value string `json:"value"`
}

Jump to

Keyboard shortcuts

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