utils

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2021 License: Apache-2.0 Imports: 12 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAlreadyExists = errors.New("already exists")
View Source
var ErrForbidden = errors.New("forbidden")
View Source
var ErrInvalid = errors.New("invalid input")
View Source
var ErrNotFound = errors.New("not found")
View Source
var ErrUnauthorized = errors.New("unauthorized")

Functions

func CleanPath

func CleanPath(p string) (string, error)

func CleanStaticPath

func CleanStaticPath(got string) (unescaped string, err error)

func DumpObject

func DumpObject(c interface{})

DumpObject pretty prints any object to the standard output. Only used for debug.

func EnsureSysAdmin

func EnsureSysAdmin(mm *pluginapi.Client, userID string) error

func FindDir

func FindDir(dir string) (string, bool)

FindDir looks for the given directory in nearby ancestors relative to the current working directory as well as the directory of the executable, falling back to `./` if not found.

func LastN

func LastN(s string, n int) string

func LoadSession

func LoadSession(mm *pluginapi.Client, sessionID, actingUserID string) (*model.Session, error)

func NewAlreadyExistsError

func NewAlreadyExistsError(args ...interface{}) error

func NewError

func NewError(source error, args ...interface{}) error

func NewForbiddenError

func NewForbiddenError(args ...interface{}) error

func NewInvalidError

func NewInvalidError(args ...interface{}) error

func NewNotFoundError

func NewNotFoundError(args ...interface{}) error

func NewUnauthorizedError

func NewUnauthorizedError(args ...interface{}) error

func Pretty

func Pretty(in interface{}) string

func ToJSON

func ToJSON(in interface{}) string

Types

type ByteSize

type ByteSize int64

func ParseByteSize

func ParseByteSize(str string) (ByteSize, error)

func (ByteSize) String

func (size ByteSize) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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