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.

74 lines
1.3 KiB

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. -- name: ReplaceDeviceAuth :exec
  18. REPLACE INTO device_auth (id, api_key, extras)
  19. VALUES (?, ?, ?);
  20. -- name: ReplaceDeviceInfo :exec
  21. REPLACE INTO device_info (id, kind, data)
  22. VALUES (?, ?, ?);
  23. -- name: ReplaceDeviceAssignment :exec
  24. REPLACE INTO device_assignment (id, created_date, `match`, effect)
  25. VALUES (?, ?, ?, ?);
  26. -- name: DeleteDeviceInfo :exec
  27. DELETE
  28. FROM device_info
  29. WHERE id = ?
  30. AND kind = ?;
  31. -- name: DeleteDeviceInfoByID :exec
  32. DELETE
  33. FROM device_info
  34. WHERE id = ?;
  35. -- name: DeleteDeviceInfoLike :exec
  36. DELETE
  37. FROM device_info
  38. WHERE id LIKE ?;
  39. -- name: DeleteDeviceAssignment :exec
  40. DELETE
  41. FROM device_assignment
  42. WHERE id = ?;
  43. -- name: DeleteDeviceAuth :exec
  44. DELETE
  45. FROM device_auth
  46. WHERE id = ?;
  47. -- name: DeleteDeviceAlias :exec
  48. DELETE
  49. FROM device_alias
  50. WHERE id = ?
  51. AND alias = ?;
  52. -- name: DeleteDeviceAliasByID :exec
  53. DELETE
  54. FROM device_alias
  55. WHERE id = ?;
  56. -- name: DeleteDeviceAliasByIDLike :exec
  57. DELETE
  58. FROM device_alias
  59. WHERE id LIKE ?;