utils

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package utils: Code generation string handling utilities Provides string formatting and quoting functions for code generation Supports type conversion and quote manipulation for generated code

utils: 代码生成的字符串处理工具 提供代码生成的字符串格式化和引用函数 支持生成代码的类型转换和引号处理

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CodeString

func CodeString(v any) string

CodeString converts any value to its Go code string representation Handles int and string types with proper formatting Returns formatted string suitable for code generation

CodeString 将任何值转换为其 Go 代码字符串表示 处理 int 和 string 类型,具有适当的格式 返回适合代码生成的格式化字符串

func GetGenPosFuncMark added in v0.0.4

func GetGenPosFuncMark(skip int) string

GetGenPosFuncMark gets position information to trace code generation Returns formatted string showing source file and function that triggered generation Uses runtime.Caller to walk up stack using specified frame count Supports URL-encoded file paths

GetGenPosFuncMark 获取调用位置信息,用于追踪代码生成 返回格式化字符串,显示触发生成的源文件和函数 使用 runtime.Caller 按指定帧数向上遍历调用栈 支持URL编码的文件路径

func TrimQuotes

func TrimQuotes(s string) string

TrimQuotes removes surrounding double quotes from a string Used to extract raw string content from quoted literals Returns unquoted string content

TrimQuotes 从字符串中移除周围的双引号 用于从引用字面量中提取原始字符串内容 返回未引用的字符串内容

func WithQuotes

func WithQuotes(s string) string

WithQuotes wraps a string with double quotes Used to generate quoted string literals in code Returns quoted string for code insertion

WithQuotes 用双引号包装字符串 用于生成代码中的引用字符串字面量 返回用于插入代码的引用字符串

Types

This section is empty.

Jump to

Keyboard shortcuts

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