modulepackage
1.0.4
Repository: https://github.com/rosbit/db-proxy-driver.git
Documentation: pkg.go.dev
# README
db-proxy-driver
db-proxy-driver
is an implementation of database/sql/driver to access db-proxy,
which is a proxy database server to any real database servers.
Usage
- register driver
import (
_ "github.com/rosbit/db-proxy-driver"
)
-
driver name and DSN
- the driver name is
"dbproxy"
- the format of DSN depends on the real driver & DSN. e.go., the origininal DSN for driver
mysql
is named"user:password@tcp(host:port)/db?charset=utf8mb4"
, the new DSN is "mysql:user:password@tcp(host:port)db?charset=utf8mb4", which is the concatation of the real driver name, the colon and the orgininal DSN.
- the driver name is
-
specify the
db-proxy
server If thedb-proxy
server is listening at host:http-port for HTTP and WebSocket service, host:rpc-port for net/rpc service, environment is used to specfiy where is thedb-proxy
server, and which protocol is used.- HTTP_DB_PROXY_BASEURL=http://host:http-port will make
db-proxy-driver
to accessdb-proxy
with HTTP - JSONLRPC_DB_PROXY_HOST=host:rpc-port will make
db-proxy-driver
to accessdb-proxy
with net/rpc - JSONLRPC_DB_PROXY_WS_HOST=host:http-port will make
db-proxy-driver
to accessdb-proxy
with net/rpc over Websocket
- HTTP_DB_PROXY_BASEURL=http://host:http-port will make
-
using ORM package
xorm
xorm
is supported, just add ago build
tag like the following.go build -tags xorm
# Structs
No description provided by the author
-------- a driver implementation -----------.
-------- a driver implementation -----------.
No description provided by the author
No description provided by the author
# Interfaces
No description provided by the author