Documentation ¶
Overview ¶
Package svc
Index ¶
- Variables
- func AesDecrypt(cipherBytes []byte) ([]byte, error)
- func AesEncrypt(plainText []byte) (string, error)
- func AesKey() string
- 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 Callback(err0 error, fns ...func()) (err error)
- func Callback1[T any](err0 error, t T, fns ...func(t T)) (err error)
- func Callback1Err[T any](err0 error, t T, fns ...func(t T) (err error)) (err error)
- func Callback2[T1, T2 any](err0 error, t1 T1, t2 T2, fns ...func(t1 T1, t2 T2)) (err error)
- func Callback2Err[T1, T2 any](err0 error, t1 T1, t2 T2, fns ...func(t1 T1, t2 T2) (err error)) (err error)
- func Callback3[T1, T2, T3 any](err0 error, t1 T1, t2 T2, t3 T3, fns ...func(t1 T1, t2 T2, t3 T3)) (err error)
- func Callback3Err[T1, T2, T3 any](err0 error, t1 T1, t2 T2, t3 T3, fns ...func(t1 T1, t2 T2, t3 T3) (err error)) (err error)
- func CallbackErr(err0 error, fns ...func() (err error)) (err error)
- func Cors(configure ...func(opt *CorsOption)) gin.HandlerFunc
- 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) *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 Return[T any](t T, err0 error) (T, error)
- func StringToBytes(s string) []byte
- func Uri(ctx *gin.Context, thenFunc noReqNoRespThenFunc, encrypts ...bool)
- func UriReq[REQ any](ctx *gin.Context, req REQ, thenFunc reqNoRespThenFunc[REQ], encrypts ...bool)
- func UriReqResp[REQ, RESP any](ctx *gin.Context, req REQ, thenFunc thenFunc[REQ, RESP], encrypts ...bool)
- func UriResp[RESP any](ctx *gin.Context, thenFunc noReqRespThenFunc[RESP], encrypts ...bool)
- func ValidatorLangFunc(fn func(ctx *gin.Context) (lang string))
- func ValidatorLangSupport(lang ...string)
- func WebTry(fs embed.FS, configure ...func(opt *WebTryOption)) func(ctx *gin.Context)
- 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 CorsOption
- type Error
- type HttpResponse
- type PageReq
- type PageResp
- type WebTryOption
Constants ¶
This section is empty.
Variables ¶
View Source
var ( EncryptEnable = os.Getenv("ENCRYPT_ENABLE") == "T" DecryptEnable = os.Getenv("DECRYPT_ENABLE") == "T" )
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 Callback1Err ¶
func Callback2Err ¶
func Callback3Err ¶
func CallbackErr ¶
func Cors ¶
func Cors(configure ...func(opt *CorsOption)) gin.HandlerFunc
func Decryption ¶
func Decryption() gin.HandlerFunc
func FormReqResp ¶
func GetAppWithGroup ¶
func GetAppWithGroup(prefix string) *gin.RouterGroup
func QueryReqResp ¶
func StringToBytes ¶
StringToBytes converts string to byte slice without a memory allocation.
func UriReqResp ¶
func ValidatorLangFunc ¶
func ValidatorLangSupport ¶
func ValidatorLangSupport(lang ...string)
func WriteMessageJSON ¶
func WriteServerErrorJSON ¶
Types ¶
type CorsOption ¶
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
func NewErrorWithCode ¶
func NewErrorWithHttpCode ¶
type HttpResponse ¶
Click to show internal directories.
Click to hide internal directories.