utils

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MARKDOWN_CODE_BLOCK = "```"
)

Variables

This section is empty.

Functions

func Append

func Append[T comparable](s []T, vs ...T) []T

func DedupSlice

func DedupSlice[T comparable](s []T) []T

func ExtractMDCodes

func ExtractMDCodes(resp string, lang string) (js string, realLang uniast.Language, last int)

func ExtractXMLBlock

func ExtractXMLBlock(text string, tag string) (string, int)

func IterateXMLBlock

func IterateXMLBlock(text string, tag string, hook func(block string) bool)

func LangToMDBlock

func LangToMDBlock(lang uniast.Language) string

func MDBlockToLang

func MDBlockToLang(lang string) uniast.Language

func MarshalJSONBytes

func MarshalJSONBytes(input any) ([]byte, error)

func MarshalJSONIndent

func MarshalJSONIndent(input any) (string, error)

func MarshalJSONIndentNoError

func MarshalJSONIndentNoError(input any) string

func MustWriteFile

func MustWriteFile(fpath string, data []byte) error

func NewError

func NewError(msg string, v ...interface{}) error

func NormalizeString

func NormalizeString(s string, sep rune) string

scan each non-alphanumeric character as a separator

func UnmarshalJSON

func UnmarshalJSON(input string, output any) error

func UnmarshalJSONBytes

func UnmarshalJSONBytes(input []byte, output any) error

func WatchDir

func WatchDir(dir string, cb func(op fsnotify.Op, file string)) error

use fsnotify to watch the file changes

func WrapError

func WrapError(err error, msg string, v ...interface{}) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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