Documentation ¶
Overview ¶
Package svc
Index ¶
- Variables
- func AesDecrypt(cipherBytes []byte) ([]byte, error)
- func AesEncrypt(plainText []byte) (string, error)
- func Body(ctx *gin.Context, thenFunc noReqNoRespThenFunc, encrypts ...bool)
- func BodyReq[REQ any](ctx *gin.Context, req REQ, thenFunc reqNoRespThenFunc[REQ], encrypts ...bool)
- func BodyReqResp[REQ, RESP any](ctx *gin.Context, req REQ, thenFunc thenFunc[REQ, RESP], encrypts ...bool)
- func BodyResp[RESP any](ctx *gin.Context, thenFunc noReqRespThenFunc[RESP], encrypts ...bool)
- func BytesToString(b []byte) string
- func Decryption() gin.HandlerFunc
- func Form(ctx *gin.Context, thenFunc noReqNoRespThenFunc, encrypts ...bool)
- func FormReq[REQ any](ctx *gin.Context, req REQ, thenFunc reqNoRespThenFunc[REQ], encrypts ...bool)
- func FormReqResp[REQ, RESP any](ctx *gin.Context, req REQ, thenFunc thenFunc[REQ, RESP], encrypts ...bool)
- func FormResp[RESP any](ctx *gin.Context, thenFunc noReqRespThenFunc[RESP], encrypts ...bool)
- func GetApp(middlewares ...gin.HandlerFunc) *gin.Engine
- func GetAppWithGroup(prefix string, middlewares ...gin.HandlerFunc) *gin.RouterGroup
- func MapFormWithTag(ptr any, form map[string][]string, tag string) error
- func Pagination(db *gorm.DB, req PageReq, count *int64, list any) (err error)
- func Query(ctx *gin.Context, thenFunc noReqNoRespThenFunc, encrypts ...bool)
- func QueryReq[REQ any](ctx *gin.Context, req REQ, thenFunc reqNoRespThenFunc[REQ], encrypts ...bool)
- func QueryReqResp[REQ, RESP any](ctx *gin.Context, req REQ, thenFunc thenFunc[REQ, RESP], encrypts ...bool)
- func QueryResp[RESP any](ctx *gin.Context, thenFunc noReqRespThenFunc[RESP], encrypts ...bool)
- func StringToBytes(s string) []byte
- func WriteBindError(ctx *gin.Context, err error, encrypts ...bool)
- func WriteJSON(ctx *gin.Context, code, httpCode int, msg string, err error, data any, ...)
- func WriteMessageJSON(ctx *gin.Context, httpCode int, str string, encrypts ...bool)
- func WriteServerErrorJSON(ctx *gin.Context, err error, encrypts ...bool)
- func WriteSuccessJSON(ctx *gin.Context, data any, encrypts ...bool)
- func WriteSuccessOrErrorJSON(ctx *gin.Context, err error, encrypts ...bool)
- type Error
- type PageReq
- type PageResp
Constants ¶
This section is empty.
Variables ¶
View Source
var ( EncryptEnable = os.Getenv("ENCRYPT_ENABLE") == "T" DecryptEnable = os.Getenv("DECRYPT_ENABLE") == "T" AesKey = os.Getenv("AES_KEY") )
View Source
var (
ErrNoReturn = io.ErrNoProgress
)
Functions ¶
func AesDecrypt ¶
func AesEncrypt ¶
func BodyReqResp ¶
func BytesToString ¶
BytesToString converts byte slice to string without a memory allocation.
func Decryption ¶
func Decryption() gin.HandlerFunc
func FormReqResp ¶
func GetAppWithGroup ¶
func GetAppWithGroup(prefix string, middlewares ...gin.HandlerFunc) *gin.RouterGroup
func QueryReqResp ¶
func StringToBytes ¶
StringToBytes converts string to byte slice without a memory allocation.
func WriteMessageJSON ¶
func WriteServerErrorJSON ¶
Types ¶
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
func NewErrorWithCode ¶
func NewErrorWithHttpCode ¶
Click to show internal directories.
Click to hide internal directories.