utils

package
v2.20.2 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Camel2Case

func Camel2Case(name string) string

驼峰式写法转为下划线写法

func Case2BigCamel

func Case2BigCamel(name string) string

下划线写法转为大驼峰写法

func Case2SmallCamel

func Case2SmallCamel(name string) string

下划线写法转为小驼峰写法

func Contains

func Contains(list []string, s string) bool

func Find

func Find(list []string, s string) int

func GenwhereToken

func GenwhereToken(columns []string) []string

func GenwhereTokenOfBatch

func GenwhereTokenOfBatch(columns []string, num int) string

func GetSoftDelType

func GetSoftDelType(t reflect.Type) softdelete.SoftDelType

GetSoftDelType 获取一个 struct 的 type 的软删除类型

func HighlightSQL

func HighlightSQL(sql string) string

func IsNil

func IsNil(v any) bool

IsNil nil 值在传到 interface{}、any 时,无法通过 == nil,来判断是否为nil ptr nil 为 true 非ptr,零值为 false

func IsSoftDelFieldType

func IsSoftDelFieldType(t reflect.Type) bool

func Lcfirst

func Lcfirst(str string) string

首字母小写

func PanicErr

func PanicErr(err error)

func PrintSql

func PrintSql(disableColor bool, originalSql, dialectSql string, args ...any)

PrintSql 打印SQL语句及其参数,第一个参数控制是否启用颜色输出

func ToSlice

func ToSlice(v reflect.Value) []any

func ToSliceValue

func ToSliceValue(v reflect.Value) []reflect.Value

func Ucfirst

func Ucfirst(str string) string

首字母大写

Types

type Buffer

type Buffer struct {
	*bytes.Buffer
}

内嵌bytes.Buffer,支持连写

func NewBuffer

func NewBuffer() *Buffer

func (*Buffer) Append

func (b *Buffer) Append(i any) *Buffer

type RuneBuffer

type RuneBuffer struct {
	// contains filtered or unexported fields
}

RuneBuffer 高效字符缓冲区

func NewRuneBuffer

func NewRuneBuffer(capacity int) *RuneBuffer

创建缓冲区

func (*RuneBuffer) LastChars

func (b *RuneBuffer) LastChars(n int) string

获取最后 n 个字符

func (*RuneBuffer) Len

func (b *RuneBuffer) Len() int

缓冲区长度(字符数)

func (*RuneBuffer) Reset

func (b *RuneBuffer) Reset()

重置缓冲区

func (*RuneBuffer) RetrieveLastChars

func (b *RuneBuffer) RetrieveLastChars(n int) string

取回最后 n 个字符(移除并返回)

func (*RuneBuffer) Rewind

func (b *RuneBuffer) Rewind(n int)

回退最后 n 个字符(仅移除,不返回)

func (*RuneBuffer) Runes

func (b *RuneBuffer) Runes() []rune

获取 rune 切片

func (*RuneBuffer) String

func (b *RuneBuffer) String() string

获取字符串表示

func (*RuneBuffer) WriteString

func (b *RuneBuffer) WriteString(s string)

写入字符串

Jump to

Keyboard shortcuts

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