util

package
v0.0.0-...-76f8149 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrCodeSuccess           = 0
	ErrCodeParameter         = 1001
	ErrCodeUserExist         = 1002
	ErrCodeServerBusy        = 1003
	ErrCodeUserNotExist      = 1004
	ErrCodeUserPasswordWrong = 1005
	ErrCodeCaptionHit        = 1006
	ErrCodeContentHit        = 1007
	ErrCodeNotLogin          = 1008
	ErrCodeRecordExist       = 1009
)

Variables

This section is empty.

Functions

func GetMessage

func GetMessage(code int) (message string)

func GetQueryInt64

func GetQueryInt64(c *gin.Context, key string) (value int64, err error)

func Md5

func Md5(data []byte) (result string)

func ResponseError

func ResponseError(ctx *gin.Context, code int)

func ResponseSuccess

func ResponseSuccess(ctx *gin.Context, data interface{})

Types

type Node

type Node struct {
	Data interface{}

	Depth int
	// contains filtered or unexported fields
}

func NewNode

func NewNode() *Node

type ResponseData

type ResponseData struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data"`
}
{
	"code": 0, //0表示成功,其他表示失败
	"message":"success", //用来描述失败的原因
	"data":{

	}
}

type Trie

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

func NewTrie

func NewTrie() *Trie

func (*Trie) Add

func (p *Trie) Add(key string, data interface{}) (err error)

假如我要把 敏感词: “我操” Add("我操", nil) Add("色情片", nil)

func (*Trie) Check

func (p *Trie) Check(text, replace string) (result string, hit bool)

text = "我们都喜欢王八蛋" replace = "***"

func (*Trie) PrefixSearch

func (p *Trie) PrefixSearch(key string) (result []*Node)

Jump to

Keyboard shortcuts

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