Pārlūkot izejas kodu

Update and rename datatables.go to filter.go

master
Saúl Ortega GitHub pirms 6 gadiem
vecāks
revīzija
c83453f363
Šim parakstam datu bāzē netika atrasta zināma atslēga GPG atslēgas ID: 4AEE18F83AFDEB23
1 mainītis faili ar 25 papildinājumiem un 22 dzēšanām
  1. +25
    -22
      filter.go

datatables.go → filter.go Parādīt failu

@@ -49,6 +49,10 @@ func MustParse(r *http.Request) Filter {
return f
}

func (f *Filter) PrepareResponse() Response {
return Response{Draw: f.Draw}
}

func parse(r *http.Request) (Filter, error) {
var E error
var F = Filter{
@@ -60,6 +64,27 @@ func parse(r *http.Request) (Filter, error) {
var mapColsTmp = make(map[int]map[string]string)
var mapOrdsTmp = make(map[int]map[string]string)

F.Draw, E = ptoi(r, "draw")
if E != nil {
errores = append(errores, E.Error())
}
F.Start, E = ptoi(r, "start")
if E != nil {
errores = append(errores, E.Error())
}
F.Length, E = ptoi(r, "length")
if E != nil {
errores = append(errores, E.Error())
}
F.SearchValue, E = ptos(r, "search[value]")
if E != nil {
errores = append(errores, E.Error())
}
F.SearchRegex, E = ptob(r, "search[regex]")
if E != nil {
errores = append(errores, E.Error())
}

for ll, v := range r.Form {
if regexp.MustCompile(`^columns\[`).MatchString(ll) {
a := regexp.MustCompile(`^columns\[([0-9]+)\]\[`).ReplaceAllString(ll, "$1-")
@@ -90,28 +115,6 @@ func parse(r *http.Request) (Filter, error) {
mapOrdsTmp[i] = make(map[string]string)
}
mapOrdsTmp[i][p[1]] = v[0]
} else if ll == "search[value]" {
F.SearchValue = strings.TrimSpace(v[0])
} else if ll == "search[regex]" {
F.SearchRegex, E = strconv.ParseBool(v[0])
if E != nil {
errores = append(errores, E.Error())
}
} else if ll == "start" {
F.Start, E = strconv.Atoi(v[0])
if E != nil {
errores = append(errores, E.Error())
}
} else if ll == "length" {
F.Length, E = strconv.Atoi(v[0])
if E != nil {
errores = append(errores, E.Error())
}
} else if ll == "draw" {
F.Draw, E = strconv.Atoi(v[0])
if E != nil {
errores = append(errores, E.Error())
}
}
}


Notiek ielāde…
Atcelt
Saglabāt