str

package
v0.0.0-...-a89011a Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckHasVar

func CheckHasVar(str string) bool

CheckHasVar 检查字符串是否有占位符

func ConvertDollarPlaceholder

func ConvertDollarPlaceholder(sql, dbType string) string

ConvertDollarPlaceholder 转postgres风格占位符

func ProcessVar

func ProcessVar(pattern, key string, val interface{}) string

func RandomStr

func RandomStr(num int) string

RandomStr 创建指定长度的随机字符

func RemoveBraces

func RemoveBraces(s string) string

RemoveBraces A function that takes a string with ${} and returns a string without them

func SprintfDict

func SprintfDict(pattern string, dict map[string]interface{}) string

SprintfDict formats a string according to a pattern and a dictionary of variables. The pattern is a string that contains placeholders for the variables in the form of ${key}. The dict is a map from keys to values that will replace the placeholders. For example, SprintfDict(“Hello, ${name}!”, map[string]string{“name”: “Alice”}) returns “Hello, Alice!”. If the pattern contains a key that is not in the dict, it will be left unchanged. If the dict contains a key that is not in the pattern, it will be ignored.

func ToString

func ToString(input interface{}) string

ToString input的值转成字符串

func ToStringMapString

func ToStringMapString(input interface{}) map[string]interface{}

ToStringMapString 把interface类型 转 map[string]string类型

Types

This section is empty.

Jump to

Keyboard shortcuts

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