Documentation
¶
Overview ¶
stringutil 包含有用于处理字符串的工具函数。
Index ¶
- Constants
- Variables
- func Base64Decode(str string) string
- func BinarySearch(nums []int, target int) int
- func BubbleSort(arr *[]int)
- func FileGetContent(file string) string
- func Get(url string) string
- func GetCookie(r *http.Request, name string) string
- func GetOutboundIP() (net.IP, error)
- func GetServerIP() (net.IP, error)
- func GetUrlArg(r *http.Request, name string) string
- func HTTPGet(uri string) ([]byte, error)
- func HTTPGetContext(ctx context.Context, uri string) ([]byte, error)
- func HTTPPost(uri string, data string) ([]byte, error)
- func HTTPPostContext(ctx context.Context, uri string, data string) ([]byte, error)
- func InsertionSort(arr *[]int)
- func Int2Str(i interface{}) string
- func IsFileExist(path string) (bool, error)
- func IsFileNotExist(path string) (bool, error)
- func IsMobile(userAgent string) bool
- func LeftBound(nums []int, target int) int
- func LeftBound2(nums []int, target int) int
- func LimitFreqSingle(queueName string, count uint, timeWindow int64) bool
- func Logger() *logrus.Logger
- func MakeToken(obj map[string]interface{}) (string, error)
- func Md5(src string) string
- func MergeSort(arr *[]int, left int, right int)
- func MyPointer()
- func MyStruct()
- func MyTest()
- func NewLimitQueue()
- func NilChannel()
- func ParseIp(myip string) *ipdb.CityInfo
- func ParseToken(tokenStr string) map[string]interface{}
- func Post(url string, contentType string, body []byte) (string, error)
- func PostFile(fieldname, filename, uri string) ([]byte, error)
- func PostForm(url string, data url.Values) (string, error)
- func PostHeader(url string, msg []byte, headers map[string]string) (string, error)
- func PostJSON(uri string, obj interface{}) ([]byte, error)
- func PostJSONWithRespContentType(uri string, obj interface{}) ([]byte, string, error)
- func PostMultipartForm(fields []MultipartFormField, uri string) (respBody []byte, err error)
- func PostXML(uri string, obj interface{}) ([]byte, error)
- func QuickSort(arr *[]int, left int, right int)
- func QuickSort2(arr *[]int, left int, right int)
- func RedirectStderr(f *os.File)
- func Reverse(s string) string
- func Reverse2(s string) string
- func RightBound(nums []int, target int) int
- func SelectionSort(arr *[]int)
- func SendSmtp(server string, from string, password string, to []string, subject string, ...) error
- func Session(keyPairs string) gin.HandlerFunc
- func SessionConfig() sessions.Store
- func SetCookie(name string, value string, w *http.ResponseWriter)
- func Sha256(src string) string
- func ShowStringByte(str string)
- func SortMap(youMap map[string]interface{}) []interface{}
- func Uuid() string
- type ImportSqlTool
- type IndexData
- type JsonListResult
- type JsonResult
- type LimitQueeMap
- type ListNode
- type MailItem
- type MailPageList
- type MailServer
- type MultipartFormField
- type SmtpBody
- type Snowflake
- type ViewData
- type ViewHtml
Constants ¶
View Source
const SECRET = "taoshihan"
Variables ¶
View Source
var LimitQueue = &LimitQueeMap{ LimitQueue: make(map[string][]int64), }
Functions ¶
func Base64Decode ¶
func BinarySearch ¶
func GetServerIP ¶
func HTTPGetContext ¶
HTTPGetContext get 请求
func HTTPPostContext ¶
HTTPPostContext post 请求
func LeftBound2 ¶
func LimitFreqSingle ¶
单机时间滑动窗口限流法
func NewLimitQueue ¶
func NewLimitQueue()
func NilChannel ¶
func NilChannel()
func ParseToken ¶
func Post ¶
Post("http://xxxx","application/json;charset=utf-8",[]byte("{'aaa':'bbb'}"))
func PostHeader ¶
func PostJSONWithRespContentType ¶
PostJSONWithRespContentType post json数据请求,且返回数据类型
func PostMultipartForm ¶
func PostMultipartForm(fields []MultipartFormField, uri string) (respBody []byte, err error)
PostMultipartForm 上传文件或其他多个字段
func QuickSort2 ¶
快速排序2 找到一个基准,左边是所有比它小的,右边是比它大的,分别递归左右
func RightBound ¶
func SessionConfig ¶
func ShowStringByte ¶
func ShowStringByte(str string)
Types ¶
type ImportSqlTool ¶
func (*ImportSqlTool) ImportSql ¶
func (this *ImportSqlTool) ImportSql() error
type JsonListResult ¶
type JsonListResult struct {
JsonResult
Result interface{} `json:"result"`
}
type JsonResult ¶
type ListNode ¶
type ListNode struct {
// contains filtered or unexported fields
}
单链表节点的结构
func NewListNode ¶
func ReverseKGroup ¶
func ReverseList ¶
func ReverseSingleList ¶
* 反转区间 [a, b) 的元素,注意是左闭右开
type MailPageList ¶
type MailPageList struct {
MailItems []*MailItem
}
type MailServer ¶
type MailServer struct {
Server, Email, Password string
}
func GetMailServerFromCookie ¶
func GetMailServerFromCookie(r *http.Request) *MailServer
type MultipartFormField ¶
MultipartFormField 保存文件或其他字段信息
type Snowflake ¶
A Snowflake struct holds the basic information needed for a snowflake generator worker
func NewSnowflake ¶
NewNode returns a new snowflake worker that can be used to generate snowflake IDs
Click to show internal directories.
Click to hide internal directories.