Documentation ¶
Index ¶
- Constants
- Variables
- func CallApi[Resp any](w webFramework.WebFramework, core RequestCoreInterface, method string, ...) (*Resp, *response.ErrorState)
- func CallHandler[Req any, Resp any](title, path, api, method, query string, isJson bool, hasInitializer bool, ...) any
- func CallRemote[Req any, Resp any](title, path, api, method string, hasQuery, isJson bool, hasInitializer bool, ...) any
- func CallRemoteWithRespParser[Req any, Resp any](title, path, api, method string, hasQuery, isJson, forwardAuth bool, ...) any
- func ConsumeRemoteGet(w webFramework.WebFramework, api, url string, core RequestCoreInterface, ...) (int, int, string, any, bool, error)
- func ConsumeRemoteGetApi(api, url string, core RequestCoreInterface, args ...any) any
- func ConsumeRemotePost(c any, reqLog *libRequest.Request, request any, ...) (int, string, any, error)
- func DeleteHandler[Req libQuery.RecordData](title, delete, checkQuery string, core RequestCoreInterface, ...) any
- func Dml[Req libQuery.DmlModel](title, key string, core RequestCoreInterface) any
- func DmlHandler[Req libQuery.DmlModel](title, key string, core RequestCoreInterface, mode libRequest.Type, ...) any
- func GetAll[Model GetHandler](title string, core RequestCoreInterface, respHandler response.ResponseHandler, ...) any
- func GetAllMapHandler[Model MapHandler](title string, core RequestCoreInterface, respHandler response.ResponseHandler, ...) any
- func GetMapBySubHandler[Req any, Resp libQuery.RecordData](title, sql string, core RequestCoreInterface, hasParam bool) any
- func GetMapHandler[Req any, Resp libQuery.RecordData](title, sql string, core RequestCoreInterface, hasParam bool) any
- func GetPage[Model GetPageHandler](title string, core RequestCoreInterface, respHandler response.ResponseHandler, ...) any
- func GetParams(w webFramework.WebFramework, args ...any) map[string]string
- func GetQuery[Req any](title, sql string, core RequestCoreInterface, hasParam bool) any
- func GetQueryFillable[Resp libQuery.QueryWithDeps](title, query string, core RequestCoreInterface, args ...string) any
- func GetQueryHandler[Req, Resp any](title, sql string, core RequestCoreInterface, args ...any) any
- func GetQueryMap[Req any](title, sql string, core RequestCoreInterface, hasParam bool) any
- func GetSingleRecord[Model GetHandler](title string, core RequestCoreInterface, respHandler response.ResponseHandler, ...) any
- func GetSingleRecordHandler[Req, Resp any](title, sql string, core RequestCoreInterface) any
- func Init() (ut.Translator, *validator.Validate, error)
- func InitPostRequest(ctx webFramework.WebFramework, reqLog *libRequest.Request, method, url string, ...) (int, map[string]string, error)
- func InitReqLog(w webFramework.WebFramework, reqLog *libRequest.Request, ...) *response.ErrorState
- func PaddedIpValidator(fl validator.FieldLevel) bool
- func PostHandler[Req libQuery.RecordDataDml](title string, core RequestCoreInterface, hasInitializer bool, ...) any
- func PutHandler[Req libQuery.RecordDataDml](title string, core RequestCoreInterface, hasInitializer bool, ...) any
- func QueryHandler[Req libQuery.QueryRequest, Resp libQuery.QueryResult](title, key string, queryMap map[string]libQuery.QueryCommand, ...) any
- func UpdateHandler[Req libQuery.Updatable](title string, hasReqLog bool, core RequestCoreInterface, hasInitializer bool, ...) any
- type Empty
- type GetHandler
- type GetPageHandler
- type MapHandler
- type RequestCoreInterface
- type RequestCoreModel
- func (m RequestCoreModel) Consumer() libCallApi.CallApiInterface
- func (m RequestCoreModel) Dictionary() libDictionary.DictionaryInterface
- func (m RequestCoreModel) GetDB() libQuery.QueryRunnerInterface
- func (m RequestCoreModel) Params() libParams.ParamsInterface
- func (m RequestCoreModel) RequestTools() libRequest.RequestInterface
- func (m RequestCoreModel) Responder() response.ResponseHandler
- func (m RequestCoreModel) Sm() libCrypto.Sm
- type WsResponse
Constants ¶
View Source
const RegexPaddedIp string = `^((25[0-5]|2[0-4]\d|1\d\d|0\d\d)\.?\b){4}$` //^((25[0-5]|2[0-4]\d|1\d\d|0\d\d)\.?\b){4}$
Variables ¶
View Source
var Validate *validator.Validate
Functions ¶
func CallApi ¶ added in v0.3.16
func CallApi[Resp any]( w webFramework.WebFramework, core RequestCoreInterface, method string, param libCallApi.CallParam) (*Resp, *response.ErrorState)
func CallHandler ¶ added in v0.5.0
func CallRemote ¶
func CallRemote[Req any, Resp any]( title, path, api, method string, hasQuery, isJson bool, hasInitializer bool, transmitter func( path, api, method string, requestByte []byte, headers map[string]string, parseRemoteResp func([]byte, string, int) (int, map[string]string, any, error), consumer func([]byte, string, string, string, string, map[string]string) ([]byte, string, int, error), ) (int, map[string]string, any, error), core RequestCoreInterface, args ...string, ) any
func CallRemoteWithRespParser ¶
func CallRemoteWithRespParser[Req any, Resp any]( title, path, api, method string, hasQuery, isJson, forwardAuth bool, hasInitializer bool, transmitter func( path, api, method string, requestByte []byte, headers map[string]string, parseRemoteResp func([]byte, string, int) (int, map[string]string, any, error), consumer func([]byte, string, string, string, string, map[string]string) ([]byte, string, int, error), ) (int, map[string]string, any, error), core RequestCoreInterface, parseRemoteResp func([]byte, string, int) (int, map[string]string, any, error), args ...string, ) any
func ConsumeRemoteGet ¶
func ConsumeRemoteGet( w webFramework.WebFramework, api, url string, core RequestCoreInterface, args ...any) (int, int, string, any, bool, error)
func ConsumeRemoteGetApi ¶
func ConsumeRemoteGetApi( api, url string, core RequestCoreInterface, args ...any) any
func ConsumeRemotePost ¶
func ConsumeRemotePost(c any, reqLog *libRequest.Request, request any, method, methodName, api, url string, parseRemoteResp func([]byte, string, int) (int, map[string]string, any, error), consumeHandler func([]byte, string, string, string, string, map[string]string) ([]byte, string, int, error), args ...any) (int, string, any, error)
func DeleteHandler ¶
func DeleteHandler[Req libQuery.RecordData](title, delete, checkQuery string, core RequestCoreInterface, hasInitializer bool, parser libQuery.FieldParser, ) any
func Dml ¶ added in v0.4.21
func Dml[Req libQuery.DmlModel]( title, key string, core RequestCoreInterface, ) any
func DmlHandler ¶ added in v0.5.0
func DmlHandler[Req libQuery.DmlModel]( title, key string, core RequestCoreInterface, mode libRequest.Type, validateHeader bool, ) any
func GetAll ¶
func GetAll[Model GetHandler](title string, core RequestCoreInterface, respHandler response.ResponseHandler, args ...any) any
func GetAllMapHandler ¶
func GetAllMapHandler[Model MapHandler](title string, core RequestCoreInterface, respHandler response.ResponseHandler, args ...any) any
func GetMapBySubHandler ¶
func GetMapBySubHandler[Req any, Resp libQuery.RecordData](title, sql string, core RequestCoreInterface, hasParam bool) any
func GetMapHandler ¶
func GetMapHandler[Req any, Resp libQuery.RecordData](title, sql string, core RequestCoreInterface, hasParam bool) any
func GetPage ¶
func GetPage[Model GetPageHandler](title string, core RequestCoreInterface, respHandler response.ResponseHandler, args ...any) any
func GetParams ¶ added in v0.4.18
func GetParams(w webFramework.WebFramework, args ...any) map[string]string
func GetQuery ¶
func GetQuery[Req any](title, sql string, core RequestCoreInterface, hasParam bool) any
func GetQueryFillable ¶
func GetQueryFillable[Resp libQuery.QueryWithDeps]( title, query string, core RequestCoreInterface, args ...string, ) any
func GetQueryHandler ¶
func GetQueryHandler[Req, Resp any](title, sql string, core RequestCoreInterface, args ...any) any
func GetQueryMap ¶
func GetQueryMap[Req any](title, sql string, core RequestCoreInterface, hasParam bool) any
func GetSingleRecord ¶
func GetSingleRecord[Model GetHandler](title string, core RequestCoreInterface, respHandler response.ResponseHandler, args ...any) any
func GetSingleRecordHandler ¶
func GetSingleRecordHandler[Req, Resp any](title, sql string, core RequestCoreInterface, ) any
func Init ¶
func Init() (ut.Translator, *validator.Validate, error)
func InitPostRequest ¶
func InitPostRequest( ctx webFramework.WebFramework, reqLog *libRequest.Request, method, url string, checkDuplicate func(libRequest.Request) error, addEvent func(webFramework.WebFramework, string, string, string, *libRequest.Request), insertRequest func(libRequest.Request) error, args ...any, ) (int, map[string]string, error)
initializer func(c webFramework.WebFramework, method, url string, reqLog *libRequest.Request, args ...any) (int, map[string]string, error),
func InitReqLog ¶ added in v0.3.18
func InitReqLog(w webFramework.WebFramework, reqLog *libRequest.Request, core RequestCoreInterface, method, path string) *response.ErrorState
func PaddedIpValidator ¶
func PaddedIpValidator(fl validator.FieldLevel) bool
func PostHandler ¶
func PostHandler[Req libQuery.RecordDataDml](title string, core RequestCoreInterface, hasInitializer bool, finalizer func(request Req, c any), args ...any, ) any
func PutHandler ¶
func PutHandler[Req libQuery.RecordDataDml](title string, core RequestCoreInterface, hasInitializer bool, finalizer func(request Req, c any), args ...any, ) any
func QueryHandler ¶ added in v0.5.0
func QueryHandler[Req libQuery.QueryRequest, Resp libQuery.QueryResult]( title, key string, queryMap map[string]libQuery.QueryCommand, core RequestCoreInterface, mode libRequest.Type, validateHeader bool, ) any
Types ¶
type GetHandler ¶
type GetPageHandler ¶
type MapHandler ¶
type RequestCoreInterface ¶
type RequestCoreInterface interface { GetDB() libQuery.QueryRunnerInterface RequestTools() libRequest.RequestInterface Consumer() libCallApi.CallApiInterface Responder() response.ResponseHandler Dictionary() libDictionary.DictionaryInterface Params() libParams.ParamsInterface Sm() libCrypto.Sm }
type RequestCoreModel ¶
type RequestCoreModel struct { RequestInterface libRequest.RequestInterface QueryInterface libQuery.QueryRunnerInterface RemoteApiInterface libCallApi.CallApiInterface RespHandler response.ResponseHandler Dict libDictionary.DictionaryInterface ParamMap libParams.ParamsInterface CryptoSm libCrypto.Sm }
func (RequestCoreModel) Consumer ¶
func (m RequestCoreModel) Consumer() libCallApi.CallApiInterface
func (RequestCoreModel) Dictionary ¶
func (m RequestCoreModel) Dictionary() libDictionary.DictionaryInterface
func (RequestCoreModel) GetDB ¶
func (m RequestCoreModel) GetDB() libQuery.QueryRunnerInterface
func (RequestCoreModel) Params ¶ added in v0.4.15
func (m RequestCoreModel) Params() libParams.ParamsInterface
func (RequestCoreModel) RequestTools ¶
func (m RequestCoreModel) RequestTools() libRequest.RequestInterface
func (RequestCoreModel) Responder ¶
func (m RequestCoreModel) Responder() response.ResponseHandler
func (RequestCoreModel) Sm ¶ added in v0.4.28
func (m RequestCoreModel) Sm() libCrypto.Sm
type WsResponse ¶ added in v0.3.16
type WsResponse[Result any] struct { Status int `json:"status"` Description string `json:"description"` Result Result `json:"result,omitempty"` ErrorData []response.ErrorResponse `json:"errors,omitempty"` }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.