util

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2022 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SpecialMapper = core.GonicMapper{}

SpecialMapper 特殊映射表

Functions

func ChangeValTagForUpdate

func ChangeValTagForUpdate(tag string) string

ChangeValTagForUpdate 因为修改的时候字段均不是必填项

func CheckPathIfNotExist

func CheckPathIfNotExist(path string) bool

CheckPathIfNotExist return true if file exist

func CreateDirIfNotExist

func CreateDirIfNotExist(dir string) error

CreateDirIfNotExist create dir recursion

func GetOnlyFilename

func GetOnlyFilename(path string) string

GetOnlyFilename return a filename without extension

func LowerToUpperCamel

func LowerToUpperCamel(s string) string

LowerToUpperCamel 小驼峰转大驼峰

func OpenBrowser

func OpenBrowser(url string) error

OpenBrowser opens browser

func ReflectAccess added in v1.2.1

func ReflectAccess(a ast.Expr) string

ReflectAccess 解析 ast 中对应类型的内容

func ReplaceTime2TimesISOTime

func ReplaceTime2TimesISOTime(str string) string

ReplaceTime2TimesISOTime 替换时间time.Time -> times.ISOTime

func SQLStr2GoStr

func SQLStr2GoStr(str string) string

SQLStr2GoStr 数据库字段、表名转换为大驼峰的golang命名,并且会替换一些特殊的映射规则如:ID

func SendFailResp

func SendFailResp(c *gin.Context, message string)

SendFailResp 返回失败请求

func SendResp

func SendResp(c *gin.Context, httpCode, code int, message string, data interface{})

SendResp 返回自定义数据

func SendSuccessResp

func SendSuccessResp(c *gin.Context, message string)

SendSuccessResp 返回成功请求

func UnderlineStr2Strikethrough

func UnderlineStr2Strikethrough(str string) string

UnderlineStr2Strikethrough 将下划线字符串转换为中划线

func UpperToLowerCamel

func UpperToLowerCamel(s string) string

UpperToLowerCamel 大驼峰转小驼峰

Types

type Response

type Response struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data,omitempty"`
}

Response 通用返回模型

Jump to

Keyboard shortcuts

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