common

package module
v0.0.0-...-08e1139 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: MulanPSL-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	LocalSetting  *Setting
	ConsulSetting *Setting
	DB            *gorm.DB
	Red           *redis.Client
)

Functions

func ConverToBinary

func ConverToBinary(n int) string

int 转 二进制的字符串

func GetInput

func GetInput(intput string) <-chan int

func GetMySQLFromConsul

func GetMySQLFromConsul() (db *gorm.DB, err error)

func GetRedisFromConsul

func GetRedisFromConsul() (*redis.Client, error)

func MD5Encode

func MD5Encode(data string) string

func MakePassword

func MakePassword(plainwd, salt string) string

func NewTracer

func NewTracer(serviceName string, addr string) (opentracing.Tracer, io.Closer, error)

func Resp

func Resp(w http.ResponseWriter, code int, data interface{}, message string)

func RespCreated

func RespCreated(w http.ResponseWriter, data interface{}, message string)

func RespFail

func RespFail(w http.ResponseWriter, data interface{}, message string)

func RespList

func RespList(w http.ResponseWriter, code int, data interface{}, message string, rows interface{}, total interface{}, skyWalkingDynamicField string)

func RespListFail

func RespListFail(w http.ResponseWriter, data interface{}, message string, rows interface{}, total interface{}, skyWalkingDynamicField string)

func RespListOK

func RespListOK(w http.ResponseWriter, data interface{}, message string, rows interface{}, total interface{}, skyWalkingDynamicField string)

func RespOK

func RespOK(w http.ResponseWriter, data interface{}, message string)

* 200 OKLoginSuccessVO 201 Created 401 Unauthorized 403 Forbidden 404 Not Found *

func SQ

func SQ(in <-chan int) <-chan int

func StringToArray

func StringToArray(intput string) []int

func ToInt

func ToInt(intput string) int

func ValidPassword

func ValidPassword(plainwd, salt, password string) bool

Types

type H

type H struct {
	Code                   int
	Message                string
	TraceId                string
	Data                   interface{}
	Rows                   interface{}
	Total                  interface{}
	SkyWalkingDynamicField interface{}
}

type Setting

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

func NewConsulSetting

func NewConsulSetting(url string, fileKey string) (*Setting, error)

func NewLocalSetting

func NewLocalSetting() (*Setting, error)

Jump to

Keyboard shortcuts

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