fixes struct name
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Paul 2020-06-06 15:15:32 +02:00
parent 59f831db55
commit f80a43faf1

View File

@ -57,8 +57,8 @@ func RunServer(config config.Config) (err error) {
}
// Run runs the main loop
func Run(c echo.Context, config config.Config) (res DatatableOutput, err error) {
qrzinputjson := new(DatatableInput)
func Run(c echo.Context, config config.Config) (res QrzDatatableOutput, err error) {
qrzinputjson := new(QrzDatatableInput)
var count int
if err = c.Bind(qrzinputjson); err != nil {
@ -95,7 +95,7 @@ func Run(c echo.Context, config config.Config) (res DatatableOutput, err error)
}
// BuildQuery builds main query
func BuildQuery(config config.Config, qrzdt DatatableInput) (rows *sqlx.Rows, err error) {
func BuildQuery(config config.Config, qrzdt QrzDatatableInput) (rows *sqlx.Rows, err error) {
var selectstatement, orderstatement, limitstatement, searchstatement string
selectstatement, err = SetSelectStatement(config, qrzdt)
@ -150,7 +150,7 @@ func BuildQueryCountTotal(config config.Config, qrzdt QrzDatatableInput) (cnt in
}
// SetSelectStatement build the sql select statement part
func SetSelectStatement(config config.Config, qrzdt DatatableInput) (selectstatement string, err error) {
func SetSelectStatement(config config.Config, qrzdt QrzDatatableInput) (selectstatement string, err error) {
var cols []string
colre := regexp.MustCompile(`^[A-Za-z0-9]+$`)
if len(qrzdt.Columns) > 0 {
@ -172,7 +172,7 @@ func SetSelectStatement(config config.Config, qrzdt DatatableInput) (selectstate
}
// SetOrderStatement build the sql order statement part
func SetOrderStatement(config config.Config, qrzdt DatatableInput) (orderstmt string, err error) {
func SetOrderStatement(config config.Config, qrzdt QrzDatatableInput) (orderstmt string, err error) {
var orderstmts []string
colre := regexp.MustCompile(`^[A-Za-z0-9]+$`)
orderre := regexp.MustCompile(`^(ASC|asc|DESC|desc)$`)
@ -191,7 +191,7 @@ func SetOrderStatement(config config.Config, qrzdt DatatableInput) (orderstmt st
}
// SetLimitStatement build the sql limit statement part
func SetLimitStatement(config config.Config, qrzdt DatatableInput) (limitstmt string, err error) {
func SetLimitStatement(config config.Config, qrzdt QrzDatatableInput) (limitstmt string, err error) {
intre := regexp.MustCompile(`^[0-9]+$`)
if qrzdt.Length < 1 {
qrzdt.Length = 50
@ -259,8 +259,8 @@ func RunCSVExport(c echo.Context, config config.Config) (data []byte, mime strin
return
}
// DatatableInput describes datatable query
type DatatableInput struct {
// QrzDatatableInput describes datatable query
type QrzDatatableInput struct {
Columns []struct {
Data int `json:"data"`
Name string `json:"name"`
@ -284,8 +284,8 @@ type DatatableInput struct {
Start int `json:"start"`
}
// DatatableOutput describes datatable response
type DatatableOutput struct {
// QrzDatatableOutput describes datatable response
type QrzDatatableOutput struct {
Data [][]string `json:"data"`
Draw int `json:"draw"`
RecordsTotal int `json:"recordsTotal"`