common

package
v0.0.0-...-ce4ab70 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RestBadRequest          string = "bad.request"
	RestServerInternalError string = "server.internal.error"
)
View Source
const (
	Prefix string = "url://"
)

Variables

View Source
var (
	ErrInvalidUrlFormat = errors.New("invalid url format")
	ErrEmptyLeafNode    = errors.New("empty leaf node")
)

Functions

func GetUrlLeafNode

func GetUrlLeafNode(url string) (string, error)

GetUrlNode 获取末尾节点 url:// -> 空 url://01HMQE6KCPQ0PNKFDNP5MEMZSP -> 01HMQE6KCPQ0PNKFDNP5MEMZSP url://01HMQE6KCPQ0PNKFDNP5MEMZSP/01HMQFJFKTM8513YSQXZYVF8S7 -> 01HMQFJFKTM8513YSQXZYVF8S7

func GetUrlNodes

func GetUrlNodes(url string) ([]string, error)

GetUrlNodes 获取节点集 url:// -> [] url://01HMQDV23J3HMV4CBH2MHSRN45 -> ["01HMQDV23J3HMV4CBH2MHSRN45"]

func IsValidUrl

func IsValidUrl(url string) bool

IsValidUrl 判断元数据 url 格式是否合法 example: - url:// - url://01HMQDV23J3HMV4CBH2MHSRN45 - url://01HMQDV23J3HMV4CBH2MHSRN45/01HMQE6KCPQ0PNKFDNP5MEMZSP

func WithCause

func WithCause(code, cause string) error

Types

type BizError

type BizError struct {
	// HTTP 状态码
	StatusCode int
	// Code: 业务错误码
	Code string
	// Cause: 错误原因
	Cause string
	// fileLine: 错误行号
	FileLine string
}

func (BizError) Error

func (b BizError) Error() string

type ObjectType

type ObjectType int

BasicAttr 对象类型

const (
	ObjectTypeDir  ObjectType = 1 // 文件
	ObjectTypeFile ObjectType = 2 // 目录
)

Jump to

Keyboard shortcuts

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