gitea: code.gitea.io/gitea/modules/util Index | Files

package util

import "code.gitea.io/gitea/modules/util"

Index

Package Files

compare.go path.go sanitize.go url.go util.go

Constants

const (
    // OptionalBoolNone a "null" boolean value
    OptionalBoolNone = iota
    // OptionalBoolTrue a "true" boolean value
    OptionalBoolTrue
    // OptionalBoolFalse a "false" boolean value
    OptionalBoolFalse
)

func EnsureAbsolutePath Uses

func EnsureAbsolutePath(path string, absoluteBase string) string

EnsureAbsolutePath ensure that a path is absolute, making it relative to absoluteBase if necessary

func ExistsInSlice Uses

func ExistsInSlice(target string, slice []string) bool

ExistsInSlice returns true if string exists in slice.

func GetDirectorySize Uses

func GetDirectorySize(path string) (int64, error)

GetDirectorySize returns the dumb disk consumption for a given path

func IsEmptyString Uses

func IsEmptyString(s string) bool

IsEmptyString checks if the provided string is empty

func IsEqualSlice Uses

func IsEqualSlice(target []string, source []string) bool

IsEqualSlice returns true if slices are equal.

func IsExternalURL Uses

func IsExternalURL(rawURL string) bool

IsExternalURL checks if rawURL points to an external URL like http://example.com

func IsSliceInt64Eq Uses

func IsSliceInt64Eq(a, b []int64) bool

IsSliceInt64Eq returns if the two slice has the same elements but different sequences.

func IsStringInSlice Uses

func IsStringInSlice(target string, slice []string) bool

IsStringInSlice sequential searches if string exists in slice.

func Max Uses

func Max(a, b int) int

Max max of two ints

func Min Uses

func Min(a, b int) int

Min min of two ints

func NormalizeEOL Uses

func NormalizeEOL(input []byte) []byte

NormalizeEOL will convert Windows (CRLF) and Mac (CR) EOLs to UNIX (LF)

func PathEscapeSegments Uses

func PathEscapeSegments(path string) string

PathEscapeSegments escapes segments of a path while not escaping forward slash

func SanitizeMessage Uses

func SanitizeMessage(message, unsanitizedURL string) string

SanitizeMessage sanitizes a message which may contains a sensitive URL

func SanitizeURLCredentials Uses

func SanitizeURLCredentials(unsanitizedURL string, usePlaceholder bool) string

SanitizeURLCredentials sanitizes a url, either removing user credentials or replacing them with a placeholder.

func URLJoin Uses

func URLJoin(base string, elems ...string) string

URLJoin joins url components, like path.Join, but preserving contents

func URLSanitizedError Uses

func URLSanitizedError(err error, unsanitizedURL string) error

URLSanitizedError returns the sanitized version an error whose message may contain a sensitive URL

type Int64Slice Uses

type Int64Slice []int64

Int64Slice attaches the methods of Interface to []int64, sorting in increasing order.

func (Int64Slice) Len Uses

func (p Int64Slice) Len() int

func (Int64Slice) Less Uses

func (p Int64Slice) Less(i, j int) bool

func (Int64Slice) Swap Uses

func (p Int64Slice) Swap(i, j int)

type OptionalBool Uses

type OptionalBool byte

OptionalBool a boolean that can be "null"

func OptionalBoolOf Uses

func OptionalBoolOf(b bool) OptionalBool

OptionalBoolOf get the corresponding OptionalBool of a bool

func (OptionalBool) IsFalse Uses

func (o OptionalBool) IsFalse() bool

IsFalse return true if equal to OptionalBoolFalse

func (OptionalBool) IsNone Uses

func (o OptionalBool) IsNone() bool

IsNone return true if equal to OptionalBoolNone

func (OptionalBool) IsTrue Uses

func (o OptionalBool) IsTrue() bool

IsTrue return true if equal to OptionalBoolTrue

Package util imports 9 packages (graph) and is imported by 57 packages. Updated 2019-11-19. Refresh now. Tools for package owners.