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:
"<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).
请求
响应
"metadata": {
"operation": "exec",
"duration": "294µs",
"start-time": "2020-09-24T11:13:46.405097Z",
"end-time": "2020-09-24T11:13:46.414519Z",
"rows-affected": "1",
"sql": "INSERT INTO foo (id, c1, ts) VALUES (1, 'demo', '2020-09-24T11:45:05Z07:00')"
}
}
请求
响应
"metadata": {
"operation": "query",
"duration": "432µs",
"end-time": "2020-09-24T11:13:46.420566Z",
"sql": "SELECT * FROM foo WHERE id < 3"
},
"data": "[
[0,\"test-0\",\"2020-09-24T04:13:46Z\"],
[1,\"test-1\",\"2020-09-24T04:13:46Z\"],
[2,\"test-2\",\"2020-09-24T04:13:46Z\"]
]"
}
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.
请求