utils

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloneStringMap

func CloneStringMap(src map[string]string) map[string]string

func CompactStrings

func CompactStrings(items []string) []string

func ContainsAny

func ContainsAny(s string, values ...string) bool

func EmptyAs

func EmptyAs(v string, def string) string

func Errorf

func Errorf(format string, args ...interface{})

func FilterNonEmpty

func FilterNonEmpty(values []string) []string

func FirstNonEmpty

func FirstNonEmpty(values ...string) string

func GetMapString

func GetMapString(m map[string]any, key string) string

func Infof

func Infof(format string, args ...interface{})

func IsObject

func IsObject(val any) bool

func IsSlice

func IsSlice(val any) bool

IsSlice 判断任意值是否为切片类型(兼容所有切片)

func NewCommand

func NewCommand(ctx context.Context, name string, args ...string) *exec.Cmd

NewCommand 创建带上下文的命令 作用:统一封装 ffmpeg / ffprobe 等外部命令,支持 ctx 取消、安全拼接、日志打印

func NormalizeAny

func NormalizeAny(v any) any

func NormalizeAnyMap

func NormalizeAnyMap(src map[string]any) map[string]any

NormalizeAnyMap 将 map[string]any 做递归规范化,保证 hash 稳定

func NormalizeMap

func NormalizeMap(m map[string]any) map[string]any

func NormalizeSellingPoints

func NormalizeSellingPoints(in []string) []string

func NormalizeSlice

func NormalizeSlice(arr []any) []any

func NormalizeStringSlice

func NormalizeStringSlice(in []string) []string

func ObjectToMap

func ObjectToMap(data any) (map[string]any, error)

ObjectToMap 把 对象转换为字典

func ParseFinal

func ParseFinal(data []byte) (map[string]any, error)

func SanitizeJSONBlock

func SanitizeJSONBlock(s string) string

func StringPtr

func StringPtr(str string) *string

func ToAnySlice

func ToAnySlice(val any) ([]any, bool)

func ToBool

func ToBool(v any) bool

func ToFloat64

func ToFloat64(v any) float64

func ToInt

func ToInt(v any) int

func ToInt64

func ToInt64(v any) int64

func ToMap

func ToMap(v any) map[string]any

func ToSlice

func ToSlice(v any) []any

func ToString

func ToString(v any) string

func ToStringSlice

func ToStringSlice(v any) []string

func ValueOrEmpty

func ValueOrEmpty(p *string) string

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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