MySQL 绑定规范

To setup MySQL binding create a component of type . See on how to create and apply a binding configuration.

The MySQL binding uses Go-MySQL-Driver internally.

Warning

以上示例将密钥明文存储, It is recommended to use a secret store for the secrets as described here.

If your server requires SSL your connection string must end of &tls=custom for example:

  1. "<user>:<password>@tcp(<server>:3306)/<database>?allowNativePasswords=true&tls=custom"

字段名为 ttlInSeconds

  • exec
  • query
  • close

The exec operation can be used for DDL operations (like table creation), as well as , UPDATE, DELETE operations which return only metadata (e.g. number of affected rows).

请求

响应

  1. "metadata": {
  2. "operation": "exec",
  3. "duration": "294µs",
  4. "start-time": "2020-09-24T11:13:46.405097Z",
  5. "end-time": "2020-09-24T11:13:46.414519Z",
  6. "rows-affected": "1",
  7. "sql": "INSERT INTO foo (id, c1, ts) VALUES (1, 'demo', '2020-09-24T11:45:05Z07:00')"
  8. }
  9. }

请求

响应

  1. "metadata": {
  2. "operation": "query",
  3. "duration": "432µs",
  4. "end-time": "2020-09-24T11:13:46.420566Z",
  5. "sql": "SELECT * FROM foo WHERE id < 3"
  6. },
  7. "data": "[
  8. [0,\"test-0\",\"2020-09-24T04:13:46Z\"],
  9. [1,\"test-1\",\"2020-09-24T04:13:46Z\"],
  10. [2,\"test-2\",\"2020-09-24T04:13:46Z\"]
  11. ]"
  12. }

Finally, the close operation can be used to explicitly close the DB connection and return it to the pool. This operation doesn’t have any response.

请求