utils

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	USER_ANONYMOUS = iota // 匿名用户(未登录/未注册)
	USER_FORBIDDEN        // 封禁用户(有违规被封号)
	USER_LIMITED          // 受限用户(未过审或被降级)
	USER_REGULAR          // 正常用户(正式会员)
	USER_SUPER            // 超级用户(后台管理权限)
)

用户分类

View Source
const (
	CMP_STRING_OMIT             = iota // 不比较
	CMP_STRING_CONTAINS                // 包含
	CMP_STRING_STARTSWITH              // 打头
	CMP_STRING_ENDSWITH                // 结尾
	CMP_STRING_IGNORE_SPACES           // 忽略空格
	CMP_STRING_CASE_INSENSITIVE        // 不分大小写
	CMP_STRING_EQUAL                   // 相等
)

字符串比较方式

Variables

This section is empty.

Functions

func Abort

func Abort(ctx *fiber.Ctx, code int)

func AbortJSON

func AbortJSON(ctx *fiber.Ctx, code int, body interface{})

func AccessDenied

func AccessDenied(ctx *fiber.Ctx, msg string)

拒绝访问

func ConcatWith

func ConcatWith(master, slave string) string

用:号连接两个部分,如果后一部分也存在的话

func GetAnonymousOpenUrls

func GetAnonymousOpenUrls() (urls []string)

获取可公开访问的网址

func GetLimitedBlackListUrls

func GetLimitedBlackListUrls() (urls []string)

获取受限用户黑名单中的的网址,与白名单二选一

func GetLimitedWhiteListUrls

func GetLimitedWhiteListUrls() (urls []string)

获取受限用户白名单中的的网址,不再检查正常用户权限,与黑名单二选一

func GetRegularPermissionUrls

func GetRegularPermissionUrls(ctx *fiber.Ctx) (urls []string)

获取正常用户权限可访问的网址

func GetSuperPermissionUrls

func GetSuperPermissionUrls(ctx *fiber.Ctx) (urls []string)

获取超级用户权限可访问的网址,不再检查正常用户权限

func GetUserType

func GetUserType(ctx *fiber.Ctx) (int, error)

用户分类,无法区分内部用户和普通用户

func InStringList

func InStringList(x string, lst []string, cmp int) bool

是否在字符串列表中

func IsStaticResourceUrl

func IsStaticResourceUrl(url string) bool

是否静态资源网址

func QueryDefault

func QueryDefault(ctx *fiber.Ctx, key, val string) (value string)

func RemoveSpaces

func RemoveSpaces(s string) string

删除空格

func WrapWith

func WrapWith(s, left, right string) string

如果本身不为空,在左右两边添加字符

Types

This section is empty.

Jump to

Keyboard shortcuts

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