Documentation ¶
Index ¶
- Constants
- Variables
- func AddMd5(path, salt string)
- func AddPad(str string, field domain.DefField) string
- func Base64(str string) (ret string)
- func ChangePrecision(flt float64, precision int) float64
- func ConvertForSql(str string) (ret string)
- func ConvertTmFormat(field *domain.DefField)
- func ConvertYamlStringToMapFormat(bytes []byte) (ret string)
- func CreateTimestampField(field *domain.DefField, fieldWithValue *domain.FieldWithValues)
- func CreateTimestampSectionValue(section string, values *[]interface{})
- func CreateUlidField(field *domain.DefField, fieldWithValue *domain.FieldWithValues)
- func Escape(in string, shouldEscape []rune) (out string)
- func EscapeColumnOfMysql(in string) string
- func EscapeColumnOfSqlServer(in string) string
- func EscapeValueOfMysql(in string) string
- func EscapeValueOfOracle(in string) string
- func EscapeValueOfSqlServer(in string) string
- func FormatPan(cardType string, pan string) string
- func FormatStr(format string, val interface{}, precision int) (ret string, pass bool)
- func GenBigint(hasSign bool) (ret, note string)
- func GenBin() (from, format string)
- func GenBit() (ret, note string)
- func GenChar(param string) (ret string, loop string)
- func GenDate() (rang, typ, format string)
- func GenDatetime() (rang, typ, format string)
- func GenDecimal(hasSign bool) (ret, note string)
- func GenDefByColumnType(param string, ret *FieldTypeInfo)
- func GenDouble(hasSign bool) (ret, note string)
- func GenFloat(hasSign bool) (ret, note string)
- func GenInt(hasSign bool) (ret, note string)
- func GenMediumint(hasSign bool) (ret, note string)
- func GenSmallint(hasSign bool) (ret, note string)
- func GenTime() (rang, typ, format string)
- func GenTimestamp() (rang, typ, format string)
- func GenTinyint(hasSign bool) (ret, note string)
- func GenYear() (rang, typ, format string)
- func GenerateCVV(size int) string
- func GenerateCreditCard(cardType string) (ret string)
- func GenerateIdCard() (ret string)
- func GenerateItems[TV ValType, TS StepType](start, end TV, step TS, precision int, isRand bool, repeat int, ...) (arr []interface{})
- func GenerateMac() (ret string)
- func GenerateTimeItems(start int64, end int64, step int, unit string, repeat int, repeatTag string) []interface{}
- func GenerateToken(format string) (ret string)
- func GenerateUlid(format string) (ret string)
- func GenerateUuid(format string) (ret string)
- func GetColumnType(metaType string, name string, records []interface{}, info *FieldTypeInfo)
- func GetDefFromYamlFile(path string) (po *model.ZdDef, content string, err error)
- func GetDefFromYamlString(content string) (po *model.ZdDef, err error)
- func GetFilesAndDirs(pth, typ string, res *map[string][]domain.ResFile)
- func GetPinyin(word string) string
- func GetPrecision(base float64, step interface{}) (precision int, newStep float64)
- func GetPrecisionByRecords(records []interface{}, info *FieldTypeInfo)
- func GetRandFromList(list []string, repeat, count int) (ret []interface{})
- func GetRandValuesFromRange(dataType, start, end, step string, repeat int, repeatTag, precisionStr string, ...) (ret []interface{})
- func GetRes() (ret map[string][]domain.ResFile, nameWidth, titleWidth int)
- func GetSignByRecords(records []interface{}, info *FieldTypeInfo)
- func GetType(value interface{}) string
- func GetValue[TV ValType, TS StepType](start TV, step TS, precision int, it, limit int64, isRand bool) (ret TV)
- func GetVarcharTypeByName(name string) (ret consts.VarcharType)
- func GetVarcharTypeByRecords(records []interface{}) (ret consts.VarcharType)
- func GetYamlResType(def domain.DefInfo) string
- func InterfaceToStr(val interface{}) string
- func IsFinish[TV ValType, TS StepType](a interface{}, b TV, step TS) bool
- func IsFromProtobuf(file string) bool
- func IsIDCard(id string) bool
- func IsMobilePhone(str string) (ret bool)
- func IsSelectExcelWithExpr(field domain.DefField) bool
- func IsTelPhone(str string) (ret bool)
- func ListData()
- func ListRes() (ret map[string][]domain.ResFile)
- func LoadRes(res map[string][]domain.ResFile) (ret map[string][]domain.ResFile, nameWidth, titleWidth int)
- func Md5(str string) (ret string)
- func ParseBool(str string) (ret bool)
- func ParseInt(str string) (ret int)
- func PathToName(path, key, tp string) string
- func PrintRes(res map[string][]domain.ResFile, nameWidth, titleWidth int)
- func RandDate() time.Time
- func RandPassword(length int) string
- func ReadExcelInfo(path string) (title, desc, resType string)
- func ReadTextInfo(path, key string) (title, desc, resType string)
- func ReadYamlData(path string) (typ string, insts domain.ResInstances, ranges domain.ResRanges)
- func ReadYamlInfo(path string) (title, desc, resType string)
- func RepeatSameVal[TV ValType](val TV, repeat int, arr *[]interface{})
- func ReplaceSpecialChars(bytes []byte) []byte
- func Set()
- func SetIsNum(info *FieldTypeInfo)
- func Sha1(str string) (ret string)
- func SortByName(arr []domain.ResFile) []domain.ResFile
- func UrlEncode(str string) (ret string)
- func VerifyCode(cardId string) string
- func View(res string)
- type CardProperties
- type CreditCard
- type ExpiryDate
- type FieldTypeInfo
- type PAN
- type StepType
- type ValType
Constants ¶
View Source
const ImgBindata = "" /* 90820-byte string literal not displayed */
View Source
const Json = "{\"key\": \"value\"}"
Variables ¶
View Source
var AreaCode = []string{
"11",
"12",
"13",
"14",
"15",
"21",
"22",
"23",
"31",
"32",
"33",
"34",
"35",
"36",
"37",
"41",
"42",
"43",
"44",
"45",
"46",
"50",
"51",
"52",
"53",
"54",
"61",
"62",
"63",
"64",
"65",
"71",
"81",
"82",
"91",
}
View Source
var AreaCodeMap = map[string]string{
"11": "北京",
"12": "天津",
"13": "河北",
"14": "山西",
"15": "内蒙古",
"21": "辽宁",
"22": "吉林",
"23": "黑龙江",
"31": "上海",
"32": "江苏",
"33": "浙江",
"34": "安徽",
"35": "福建",
"36": "江西",
"37": "山东",
"41": "河南",
"42": "湖北",
"43": "湖南",
"44": "广东",
"45": "广西",
"46": "海南",
"50": "重庆",
"51": "四川",
"52": "贵州",
"53": "云南",
"54": "西藏",
"61": "陕西",
"62": "甘肃",
"63": "青海",
"64": "宁夏",
"65": "新疆",
"71": "台湾",
"81": "香港",
"82": "澳门",
"91": "国外",
}
View Source
var AvailableCardTypes = map[string]CardProperties{ "amex": { LongName: "American Express", Prefix: []string{"37", "34"}, PanSize: 15, CvvSize: 4, }, "visa": { LongName: "Visa", Prefix: []string{"4"}, PanSize: 16, CvvSize: 3, }, "mc": { LongName: "Mastercard", Prefix: []string{"51", "52", "53", "54", "55"}, PanSize: 16, CvvSize: 3, }, "dci": { LongName: "Diners Club International", Prefix: []string{"36", "38"}, PanSize: 16, CvvSize: 3, }, "jcb": { LongName: "Japan Credit Bureau", Prefix: []string{"35"}, PanSize: 16, CvvSize: 3, }, "discover": { LongName: "Discover", Prefix: []string{"6011", "65"}, PanSize: 16, CvvSize: 3, }, }
View Source
var ValCodeArr = []string{
"1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2",
}
View Source
var Wi = []int{
7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2,
}
Functions ¶
func ChangePrecision ¶
func ConvertForSql ¶
func ConvertTmFormat ¶
func CreateTimestampField ¶
func CreateTimestampField(field *domain.DefField, fieldWithValue *domain.FieldWithValues)
func CreateTimestampSectionValue ¶
func CreateTimestampSectionValue(section string, values *[]interface{})
func CreateUlidField ¶
func CreateUlidField(field *domain.DefField, fieldWithValue *domain.FieldWithValues)
func EscapeColumnOfMysql ¶
func EscapeColumnOfSqlServer ¶
func EscapeValueOfMysql ¶
func EscapeValueOfOracle ¶
func EscapeValueOfSqlServer ¶
func GenDatetime ¶
func GenDatetime() (rang, typ, format string)
func GenDecimal ¶
func GenDefByColumnType ¶
func GenDefByColumnType(param string, ret *FieldTypeInfo)
func GenMediumint ¶
func GenSmallint ¶
func GenTimestamp ¶
func GenTimestamp() (rang, typ, format string)
func GenTinyint ¶
func GenerateCVV ¶
func GenerateCreditCard ¶
func GenerateIdCard ¶
func GenerateIdCard() (ret string)
func GenerateItems ¶
func GenerateMac ¶
func GenerateMac() (ret string)
func GenerateTimeItems ¶
func GenerateToken ¶
func GenerateUlid ¶
func GenerateUuid ¶
func GetColumnType ¶
func GetColumnType(metaType string, name string, records []interface{}, info *FieldTypeInfo)
func GetDefFromYamlFile ¶
func GetPrecision ¶
func GetPrecisionByRecords ¶
func GetPrecisionByRecords(records []interface{}, info *FieldTypeInfo)
func GetRandFromList ¶
func GetRandValuesFromRange ¶
func GetSignByRecords ¶
func GetSignByRecords(records []interface{}, info *FieldTypeInfo)
func GetVarcharTypeByName ¶
func GetVarcharTypeByName(name string) (ret consts.VarcharType)
func GetVarcharTypeByRecords ¶
func GetVarcharTypeByRecords(records []interface{}) (ret consts.VarcharType)
func GetYamlResType ¶
func InterfaceToStr ¶
func InterfaceToStr(val interface{}) string
func IsFromProtobuf ¶
func IsMobilePhone ¶
func IsSelectExcelWithExpr ¶
func IsTelPhone ¶
func PathToName ¶
func RandPassword ¶
func ReadExcelInfo ¶
func ReadTextInfo ¶
func ReadYamlData ¶
func ReadYamlInfo ¶
func RepeatSameVal ¶
func ReplaceSpecialChars ¶
func SetIsNum ¶
func SetIsNum(info *FieldTypeInfo)
Types ¶
type CardProperties ¶
type CreditCard ¶
type CreditCard struct { Issuer string `json:"issuer"` Pan PAN `json:"pan"` ExpiryDate ExpiryDate `json:"expiryDate"` CVV string `json:"cvv"` }
type ExpiryDate ¶
func GenerateExpiryDate ¶
func GenerateExpiryDate() ExpiryDate
type FieldTypeInfo ¶
type FieldTypeInfo struct { ColumnType consts.ColumnType VarcharType consts.VarcharType IsNum bool Precision int HasSign bool Note string Rang string Loop string Loopfix string Type string Format string From string Use string Select string Prefix string }
func GenerateFieldDefByMetadata ¶
func GenerateFieldDefByMetadata(metadata string, param string, name string, records []interface{}) (info FieldTypeInfo)
type PAN ¶
func GeneratePAN ¶
func GeneratePAN(properties CardProperties) PAN
Click to show internal directories.
Click to hide internal directories.