utils

package
v0.0.0-...-8010d25 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RegRepoURL = "https?:\\/\\/([^\\/]+)\\/([^\\/]+)\\/([^\\/]+)"
)

Variables

This section is empty.

Functions

func CheckNotExist

func CheckNotExist(src string) bool

func DetermineIdlType

func DetermineIdlType(idlPid string) (int32, error)

func FigureOutListenOn

func FigureOutListenOn(listenOn string) string

func FindRootPath

func FindRootPath(absoluteFilePath, relativeFilePath string) string

func GetGitHubTokenInfo

func GetGitHubTokenInfo(client *github.Client) (owner string, ownerId int64, tokenType int32, expirationTime time.Time, err error)

func GetGitLabTokenInfo

func GetGitLabTokenInfo(client *gitlab.Client) (owner string, ownerId int64, tokenType int32, expirationTime time.Time, err error)

func GetRepoFullUrl

func GetRepoFullUrl(repoType int32, repoUrl, ref, filePid string) string

func GetRepoFullUrlGitHub

func GetRepoFullUrlGitHub(repoUrl, ref, filePid string) string

func GetRepoFullUrlGitLab

func GetRepoFullUrlGitLab(repoUrl, ref, filePid string) string

func InternalIp

func InternalIp() string

func IsFileNotFoundError

func IsFileNotFoundError(err error) bool

IsFileNotFoundError Determine if it is file not found error issue

func IsNetworkError

func IsNetworkError(err error) bool

IsNetworkError Determine if it is a network timeout issue

func IsNotExistMkDir

func IsNotExistMkDir(src string) error

func IsTokenError

func IsTokenError(err error) bool

IsTokenError Determine if it is a Token error issue

func MkDir

func MkDir(src string) error

func NewGithubClient

func NewGithubClient(token string) (client *github.Client, err error)

func NewGitlabClient

func NewGitlabClient(token, baseURL string) (client *gitlab.Client, err error)

func NewNetAddr

func NewNetAddr(network, address string) net.Addr

NewNetAddr creates a new NetAddr object with the network and address provided.

func NewServiceId

func NewServiceId() (string, error)

func NewTaskId

func NewTaskId() (string, error)

func ParseAddr

func ParseAddr(addr net.Addr) (host string, port int, err error)

func ParseRepoFileUrl

func ParseRepoFileUrl(repoType int32, url string) (filePid, owner, repoName string, err error)

func ParseRepoFileUrlGitHub

func ParseRepoFileUrlGitHub(url string) (filePid, owner, repoName string, err error)

func ParseRepoFileUrlGitLab

func ParseRepoFileUrlGitLab(url string) (filePid, owner, repoName string, err error)

func ParseRepoUrl

func ParseRepoUrl(url string) (domain, owner, repoName string, err error)

func ProcessFolders

func ProcessFolders(fileContentMap map[string][]byte, tempDir string, paths ...string) error

func UnTar

func UnTar(archiveData []byte, tempDir string, IsTarball bool) (string, error)

UnTar Persist the tar compressed package to the specified disk. If using tarball, gzip decompression is required first

func ValidateTokenForRepoGitHub

func ValidateTokenForRepoGitHub(client *github.Client, owner, repoName string) (bool, error)

func ValidateTokenForRepoGitLab

func ValidateTokenForRepoGitLab(client *gitlab.Client, owner, repoName string) (bool, error)

Types

type NetAddr

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

NetAddr implements the net.Addr interface.

func (*NetAddr) Network

func (na *NetAddr) Network() string

Network implements the net.Addr interface.

func (*NetAddr) String

func (na *NetAddr) String() string

String implements the net.Addr interface.

Jump to

Keyboard shortcuts

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