Categorygithub.com/rosbit/db-proxy-driver
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

  1. register driver
import (
    _  "github.com/rosbit/db-proxy-driver"
)
  1. 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.
  2. specify the db-proxy server If the db-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 the db-proxy server, and which protocol is used.

    • HTTP_DB_PROXY_BASEURL=http://host:http-port will make db-proxy-driver to access db-proxy with HTTP
    • JSONLRPC_DB_PROXY_HOST=host:rpc-port will make db-proxy-driver to access db-proxy with net/rpc
    • JSONLRPC_DB_PROXY_WS_HOST=host:http-port will make db-proxy-driver to access db-proxy with net/rpc over Websocket
  3. using ORM package xorm

    • xorm is supported, just add a go 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