在ruby Sequel / Postgres的json字段订购

时间:2018-03-09 12:14:27

标签: json ruby postgresql sequel

我在Jeremy Evans的Ruby中使用了Sequel库,我试图在json的一个字段中订购。

我可以通过这个Postgres查询在SQL中使用它:

// ViewController.swift import UIKit class ViewController: UIViewController { @IBOutlet weak var optionA: UIButton! @IBOutlet weak var optionB: UIButton! @IBOutlet weak var optionC: UIButton! @IBOutlet weak var optionD: UIButton! override func viewDidLoad() { super.viewDidLoad() let nominees = list[myIndex] print(nominees) optionA.titleLabel?.text = nominees.optionA optionB.titleLabel?.text = nominees.optionB optionC.titleLabel?.text = nominees.optionC optionD.titleLabel?.text = nominees.optionD } } */

但我无法与Sequel / Postgres合作

SELECT * FROM files ORDER BY json->>'filename' ASC

这导致以下SQL:

table.order("json ->'filename'")

给出错误:

SELECT * FROM "files" ORDER BY 'json ->''filename'''

1 个答案:

答案 0 :(得分:1)

问题解决了:

Notification n = new Notification.Builder(context) .setContentTitle(violationHeader) .setContentText(message) .setSmallIcon(R.drawable.login_logo) .setContentIntent(pIntent) .setAutoCancel(true) .setSound(uri) .setVibrate(new long[]{10, 40, 100, 200, 10}) .build(); NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.notify(notificationId, n);