utils

package module
v0.0.0-...-f55a6fa Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DownloadGithubRepo

func DownloadGithubRepo(userID int, branch, url string) (string, string, string, error)

DownloadGithubRepo clones the repository from GitHub given the url and save it in the tmp folder, if the download successfully complete the name of the path, name and last commit hash will be returned

func GenerateRandomString

func GenerateRandomString(size int) string

GenerateRandomString will generate a random alphanumerical string of the given length

func GetLastCommitHash

func GetLastCommitHash(url, branch string)

func GetUserAndNameFromRepoUrl

func GetUserAndNameFromRepoUrl(url string) (string, string, error)

GetUserAndNameFromRepoUrl get the username of the creator and the repository's name given a GitHub repository url

func HasLastCommitChanged

func HasLastCommitChanged(commit, url, branch string) (bool, error)

HasLastCommitChanged will check if the last commit of a GitHub url is different from the given to the function TODO: should read just the last one not all the commits in the json

func ValidGithubUrl

func ValidGithubUrl(url string) error

ValidGithubUrl check if an url is a valid and existing GitHub repo url !should allow other git remotes (I.E. gitlab)

Types

type GithubCommit

type GithubCommit struct {
	SHA    string               `json:"sha"`
	Commit GithubCommitInternal `json:"commit"`
}

type GithubCommitInternal

type GithubCommitInternal struct {
	Message string `json:"message"`
}

type Util

type Util struct {
	// contains filtered or unexported fields
}

func NewUtil

func NewUtil(ctx context.Context, databaseConnectionUri string) *Util

func (Util) ConnectToDB

func (u Util) ConnectToDB() (*mongo.Database, error)

ConnectToDB returns a connection to the ipaas database

Jump to

Keyboard shortcuts

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