mirror of
https://github.com/kataras/iris.git
synced 2025-03-14 08:16:28 +01:00
mysql example: security fix
This commit is contained in:
parent
62a1829cb9
commit
4aa93ae872
|
@ -115,9 +115,8 @@ func ParseListOptions(q url.Values) ListOptions {
|
||||||
offset, _ := strconv.ParseUint(q.Get("offset"), 10, 64)
|
offset, _ := strconv.ParseUint(q.Get("offset"), 10, 64)
|
||||||
limit, _ := strconv.ParseUint(q.Get("limit"), 10, 64)
|
limit, _ := strconv.ParseUint(q.Get("limit"), 10, 64)
|
||||||
order := q.Get("order") // empty, asc(...) or desc(...).
|
order := q.Get("order") // empty, asc(...) or desc(...).
|
||||||
orderBy := q.Get("by") // e.g. price
|
|
||||||
|
|
||||||
return ListOptions{Offset: offset, Limit: limit, Order: order, OrderByColumn: orderBy}
|
return ListOptions{Offset: offset, Limit: limit, Order: order}
|
||||||
}
|
}
|
||||||
|
|
||||||
// List binds one or more records from the database to the "dest".
|
// List binds one or more records from the database to the "dest".
|
||||||
|
@ -130,10 +129,9 @@ func (s *Service) List(ctx context.Context, dest interface{}, opts ListOptions)
|
||||||
// If missing then try to set it by record info.
|
// If missing then try to set it by record info.
|
||||||
opts.Table = s.rec.TableName()
|
opts.Table = s.rec.TableName()
|
||||||
}
|
}
|
||||||
if opts.OrderByColumn == "" {
|
|
||||||
if b, ok := s.rec.(Sorted); ok {
|
if b, ok := s.rec.(Sorted); ok {
|
||||||
opts.OrderByColumn = b.SortBy()
|
opts.OrderByColumn = b.SortBy()
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
q, args := opts.BuildQuery()
|
q, args := opts.BuildQuery()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user