You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
1.3 KiB

2 years ago
2 years ago
  1. -- name: ListDeviceInfos :many
  2. SELECT *
  3. FROM device_info;
  4. -- name: ListDeviceAssignments :many
  5. SELECT *
  6. FROM device_assignment
  7. ORDER BY created_date;
  8. -- name: ListDeviceAuth :many
  9. SELECT *
  10. FROM device_auth;
  11. -- name: ListDeviceAliases :many
  12. SELECT *
  13. FROM device_alias;
  14. -- name: InsertDeviceAlias :exec
  15. INSERT INTO device_alias (id, alias)
  16. VALUES (?, ?)
  17. ON DUPLICATE KEY UPDATE alias=alias;
  18. -- name: ReplaceDeviceAuth :exec
  19. REPLACE INTO device_auth (id, api_key, extras)
  20. VALUES (?, ?, ?);
  21. -- name: ReplaceDeviceInfo :exec
  22. REPLACE INTO device_info (id, kind, data)
  23. VALUES (?, ?, ?);
  24. -- name: ReplaceDeviceAssignment :exec
  25. REPLACE INTO device_assignment (id, created_date, `match`, effect)
  26. VALUES (?, ?, ?, ?);
  27. -- name: DeleteDeviceInfo :exec
  28. DELETE
  29. FROM device_info
  30. WHERE id = ?
  31. AND kind = ?;
  32. -- name: DeleteDeviceInfoByID :exec
  33. DELETE
  34. FROM device_info
  35. WHERE id = ?;
  36. -- name: DeleteDeviceInfoLike :exec
  37. DELETE
  38. FROM device_info
  39. WHERE id LIKE ?;
  40. -- name: DeleteDeviceAssignment :exec
  41. DELETE
  42. FROM device_assignment
  43. WHERE id = ?;
  44. -- name: DeleteDeviceAuth :exec
  45. DELETE
  46. FROM device_auth
  47. WHERE id = ?;
  48. -- name: DeleteDeviceAlias :exec
  49. DELETE
  50. FROM device_alias
  51. WHERE id = ?
  52. AND alias = ?;
  53. -- name: DeleteDeviceAliasByID :exec
  54. DELETE
  55. FROM device_alias
  56. WHERE id = ?;
  57. -- name: DeleteDeviceAliasByIDLike :exec
  58. DELETE
  59. FROM device_alias
  60. WHERE id LIKE ?;