utils

package
v1.8.76 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SuperUserID              = int64(1)
	RequestPathUserIDArgName = "userID"
	AsOwnerSuffix            = "AsOwner"
	FeaturePermSeparator     = "_"
)

Variables

This section is empty.

Functions

func BatchIDs added in v1.8.52

func BatchIDs(ids []int64, batchSize int) [][]int64

func ExtractFeatureFromPerm added in v1.8.59

func ExtractFeatureFromPerm(perm Permission) string

ExtractPermParts extracts the parts of a permission into a featureName and a permissionName

func ExtractIDs added in v1.8.52

func ExtractIDs(objLen int, fn func(index int) int64) []int64

func ExtractIndex added in v1.8.75

func ExtractIndex(objLen int, fn func(index int) int64) map[int64]int

func HasPerm

func HasPerm(req *request.Request, user types.IUserContainer, perm Permission) bool

func HasPermOld

func HasPermOld(userID int64, perms []string, permName Permission) bool

HasPerm verifies that a permission exists in a userProfile's permissions

func OpenFile

func OpenFile(filePath string) (byteCount int, buffer *bytes.Buffer, e error)

OpenFile opens a file in chunks

func QueryIDs

func QueryIDs(query string) []int64

func QueryStrings added in v1.8.37

func QueryStrings(query string) []string

func SumFloat added in v1.8.53

func SumFloat(objLen int, fn func(index int) float64) float64

func SumInt64 added in v1.8.53

func SumInt64(objLen int, fn func(index int) int64) int64

Types

type Permission

type Permission string

Permission is the name of a permission

Jump to

Keyboard shortcuts

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