OrderLenDesc returns a custom predicate function (as defined in the doc), that sets the result order by the length of the given JSON value, but in descending order.
(column string, opts ...Option)
| 358 | // OrderLenDesc returns a custom predicate function (as defined in the doc), that |
| 359 | // sets the result order by the length of the given JSON value, but in descending order. |
| 360 | func OrderLenDesc(column string, opts ...Option) func(*sql.Selector) { |
| 361 | return func(s *sql.Selector) { |
| 362 | s.OrderExpr( |
| 363 | sql.DescExpr(LenPath(column, opts...)), |
| 364 | ) |
| 365 | } |
| 366 | } |
| 367 | |
| 368 | // LenPath writes to the given SQL builder the JSON path for |
| 369 | // getting the length of a given JSON path. |